package cn.reghao.tnb.user.app.model.dto;

import cn.reghao.tnb.user.api.dto.UserInfo;
import cn.reghao.tnb.user.app.model.po.UserContact;
import lombok.AllArgsConstructor;
import lombok.Data;
import lombok.NoArgsConstructor;

/**
 * @author reghao
 * @date 2022-04-16 23:04:42
 */
@NoArgsConstructor
@AllArgsConstructor
@Data
public class ContactInfo {
    private String id;
    private String nickname;
    private int gender;
    private String motto;
    private String avatar;
    private String friendRemark;
    private boolean isOnline;

    public ContactInfo(UserInfo userInfo, UserContact userContact) {
        this.id = userInfo.getUserId();
        this.nickname = userInfo.getScreenName();
        this.gender = userInfo.getGender();
        this.motto = userInfo.getSignature();
        this.avatar = userInfo.getAvatarUrl();
        this.friendRemark = userContact.getRemarkName();
        this.isOnline = userContact.getStatus() == 1;
    }
}
