package com.zhongshu.card.client.model.projectAbout.orgFace;

import com.zhongshu.card.client.model.base.SuperModel;
import com.zhongshu.card.client.model.org.UserCountSimpleModel;
import com.zhongshu.card.client.model.org.orgUser.OrganizationUserSimpleModel;
import com.zhongshu.card.client.type.Sex;
import com.zhongshu.card.client.type.common.AuditState;
import io.swagger.v3.oas.annotations.media.Schema;
import lombok.AllArgsConstructor;
import lombok.Data;
import lombok.NoArgsConstructor;
import org.apache.commons.lang3.ObjectUtils;

/**
 * @author TRX
 * @date 2024/10/12
 */
@Data
@AllArgsConstructor
@NoArgsConstructor
public class OrgUserFaceModel extends SuperModel {

    @Schema(description = "审核状态")
    private AuditState auditState;

    private String auditStateStr;

    public String getAuditStateStr() {
        if (auditState != null) {
            return auditState.getRemark();
        }
        return "";
    }

    public String passRate;

    public String getPassRate() {
        if (auditState == AuditState.Audited) {
            return "合格";
        }
        return "";
    }

    //-----------------用户信息 start -----------------
    @Schema(description = "用户ID")
    private String userId;

    @Schema(description = "用户名称")
    private String userName;

    @Schema(description = "用户电话")
    private String phone;

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

    private String sexStr;

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

    @Schema(description = "人员编码")
    private String code;

    @Schema(description = "用户信息")
    private UserCountSimpleModel userAccount;

    @Schema(description = "项目机构用户信息")
    private OrganizationUserSimpleModel organizationUser;

    @Schema(description = "图片名称")
    private String name;

    @Schema(description = "人脸图片地址")
    private String img;

    @Schema(description = "是否可使用")
    private Boolean isCanUsed;

    //------------------------审核信息 start ---------------

    @Schema(description = "审核用户userId")
    private String auditUserId;

    private String auditUserName;

    public String getAuditUserName() {
        if (ObjectUtils.isNotEmpty(auditUserAccount)) {
            return auditUserAccount.getName();
        }
        return "";
    }

    @Schema(description = "审核用户")
    private UserCountSimpleModel auditUserAccount;

    @Schema(description = "审核备注")
    private String auditRemark;

    @Schema(description = "审核时间")
    private Long auditTime;

    @Schema(description = "权限中心的人脸id")
    private String updateFaceFileId;
}
