package com.zhongshu.card.client.model.org;

import com.zhongshu.card.client.model.base.SuperModel;
import com.zhongshu.card.client.type.CertificateType;
import com.zhongshu.card.client.type.Sex;
import com.zhongshu.card.client.type.UserLoginType;
import com.zhongshu.card.client.type.UserState;
import io.swagger.v3.oas.annotations.media.Schema;
import lombok.AllArgsConstructor;
import lombok.Data;
import lombok.NoArgsConstructor;
import org.apache.commons.lang3.StringUtils;

/**
 * @author TRX
 * @date 2024/5/31
 */
@Data
@AllArgsConstructor
@NoArgsConstructor
public class UserCountModel extends SuperModel {

    @Schema(description = "用户ID（由鉴权中心颁发）")
    private String userId;

    @Schema(description = "登录名")
    private String loginName;

    @Schema(description = "用户手机号")
    private String phone;

    @Schema(description = "姓名")
    private String name;

    @Schema(description = "真实姓名")
    private String realName;

    public String getRealName(){
        if (StringUtils.isNotEmpty(realName)) {
            return realName;
        }
        return name;
    }

    @Schema(description = "用户名  用户真实姓名的拼音")
    private String spellCode;

    @Schema(description = "头像")
    private String profilePic;

    @Schema(description = "性别")
    private Sex sex;

    private String sexStr;

    public String getSexStr() {
        if (sex != null) {
            return sex.getRemark();
        }
        return "";
    }

    @Schema(description = "证件类型")
    private CertificateType certificateType = CertificateType.IDCard;

    private String certificateTypeStr;

    public String getCertificateTypeStr() {
        if (certificateType != null) {
            return certificateType.getRemark();
        }
        return "";
    }

    @Schema(description = "证件号码")
    private String cardNumber;

    @Schema(description = "地址")
    private String address;

    @Schema(description = "用户状态")
    private UserState state = UserState.Normal;

    private String stateStr;

    public String getStateStr() {
        if (state != null) {
            return state.getRemark();
        }
        return "";
    }

    @Schema(description = "可登录端类型")
    private UserLoginType loginType = UserLoginType.All;

    @Schema(description = "是否已修改了密码 (登录时提示)")
    private Boolean isUpdatedPsw = Boolean.FALSE;

    @Schema(description = "是否登录过")
    private Boolean isLogined = Boolean.FALSE;
}
