package com.gxwebsoft.common.system.entity;

import com.baomidou.mybatisplus.annotation.*;
import com.fasterxml.jackson.annotation.JsonFormat;
import io.swagger.v3.oas.annotations.media.Schema;
import lombok.Data;
import lombok.EqualsAndHashCode;

import java.io.Serializable;
import java.time.LocalDate;
import java.util.Date;

/**
 * 实名认证
 *
 * @author 科技小王子
 * @since 2025-05-29 23:01:04
 */
@Data
@EqualsAndHashCode(callSuper = false)
@Schema(name = "UserVerify对象", description = "实名认证")
@TableName("gxwebsoft_core.sys_user_verify")
public class UserVerify implements Serializable {
    private static final long serialVersionUID = 1L;

    @Schema(description = "自增ID")
    @TableId(value = "id", type = IdType.AUTO)
    private Integer id;

    @Schema(description = "用户ID")
    private Integer userId;

    @Schema(description = "认证类型, 0个人 1企业")
    private Integer type;

    @Schema(description = "主体名称")
    private String name;

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

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

    @Schema(description = "出生日期")
    private LocalDate birthday;

    @Schema(description = "正面")
    private String sfz1;

    @Schema(description = "反面")
    private String sfz2;

    @Schema(description = "营业执照号码")
    private String zzCode;

    @Schema(description = "营业执照照片")
    private String zzImg;

    @Schema(description = "其他证件")
    private String files;

    @Schema(description = "审核人")
    private Integer adminId;

    @Schema(description = "机构ID")
    private Integer organizationId;

    @Schema(description = "机构ID")
    @TableField(exist = false)
    private String organizationName;

    @Schema(description = "用户角色ID")
    private Integer userRoleId;

    @Schema(description = "备注")
    private String comments;

    @Schema(description = "状态, 0待审核, 1已通过审核，2已驳回")
    private Integer status;

    @Schema(description = "是否删除, 0否, 1是")
    @TableLogic
    private Integer deleted;

    @Schema(description = "租户id")
    private Integer tenantId;

    @Schema(description = "注册时间")
    @JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss")
    private Date createTime;

    @Schema(description = "修改时间")
    @JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss")
    private Date updateTime;

    @Schema(description = "手机号码")
    @TableField(exist = false)
    private String phone;

    @Schema(description = "状态名称")
    @TableField(exist = false)
    private String statusText;

    public String getStatusText() {
      String[] statusArray = {"待审核", "已审核通过", "已驳回"};
      return statusArray[this.status];
    }

}
