package com.bonus.common.entity.bracelet.vo;

import com.alibaba.fastjson2.annotation.JSONField;
import com.bonus.common.entity.file.ResourceFileVo;
import com.bonus.common.security.utils.SecurityUtils;
import com.fasterxml.jackson.annotation.JsonFormat;
import com.fasterxml.jackson.annotation.JsonIgnore;
import com.fasterxml.jackson.annotation.JsonIgnoreProperties;
import com.fasterxml.jackson.annotation.JsonProperty;
import lombok.Data;
import org.hibernate.validator.constraints.Length;
import org.hibernate.validator.constraints.Range;
import org.springframework.web.multipart.MultipartFile;

import javax.validation.constraints.NotBlank;
import javax.validation.constraints.NotNull;
import javax.validation.constraints.Pattern;
import java.io.Serializable;
import java.util.Date;
import java.util.List;

/**
 * @className:PersonVo
 * @author:cwchen
 * @date:2024-07-16-11:17
 * @version:1.0
 * @description:人员-vo
 */
@Data
public class PersonVo implements Serializable {

    /**
     * 序号
     */
    private String serialNumber;

    /**
     * id
     */
    private Long id;
    /**
     * 姓名
     */
    @NotBlank(message = "姓名不能为空", groups = {Query.class})
    @Length(max = 32, message = "姓名字符长度不能超过32", groups = {Query.class})
    private String name;
    /**
     * 性别 0 女 1 男 2 其他
     */
    @NotNull(message = "性别不能为空", groups = {Query.class})
    @Range(min = 0, max = 2, message = "性别应为： 0 女 1 男 2 其他", groups = {Query.class})
    private Integer sex;
    /**
     * 身份证号码
     */
    @NotBlank(message = "身份证号码不能为空", groups = {Query.class})
    @Length(max = 20, message = "身份证号码字符长度不能超过20", groups = {Query.class})
    @Pattern(regexp = "[1-9]\\d{5}(19|20)\\d{2}((01|03|05|07|08|10|12)(0[1-9]|[1-2]\\d|3[0-1])|(04|06|09|11)(0[1-9]|[1-2]\\d|30)|02(0[1-9]|[1-2]\\d))\\d{3}[\\dXx]", message = "身份证号码格式不正确", groups = {Query.class})
    private String idCard;
    /**
     * 电话
     */
    @NotBlank(message = "电话不能为空", groups = {Query.class})
    @Length(max = 20, message = "电话字符长度不能超过20", groups = {Query.class})
    @Pattern(regexp = "(0|86|17951)?(13[0-9]|19[0-9]|15[012356789]|17[678]|18[0-9]|14[57])[0-9]{8}", message = "电话格式不正确", groups = {Query.class})
    private String phone;
    /**
     * 安全帽编号
     */
    @Length(max = 10, message = "安全帽编号字符长度不能超过10", groups = {Query.class})
    private String aqmCode;
    /**
     * 马甲编号
     */
    @Length(max = 10, message = "马甲编号字符长度不能超过10", groups = {Query.class})
    private String mjCode;
    /**
     * 创建时间
     */
    @JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss", timezone = "GMT+8")
    @JsonProperty(access = JsonProperty.Access.WRITE_ONLY)
    private Date createTime = new Date();
    /**
     * 修改时间
     */
    @JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss", timezone = "GMT+8")
    @JsonProperty(access = JsonProperty.Access.WRITE_ONLY)
    private Date updateTime = new Date();
    /**
     * 创建人
     */
    @JsonProperty(access = JsonProperty.Access.WRITE_ONLY)
    private Long createUser = SecurityUtils.getUserId();
    /**
     * 修改人
     */
    @JsonProperty(access = JsonProperty.Access.WRITE_ONLY)
    private Long updateUser = SecurityUtils.getUserId();
    /**
     * 所属班组ID
     */
    private Long teamId;

    /**
     * 证书数量
     */
    private int certificateNum;

    /**
     * 资源类型
     */
    private String sourceType;

    /**
     * 删除的文件ID
     */
    @JsonProperty(access = JsonProperty.Access.WRITE_ONLY)
    private String delFiles;

    /**
     * 删除的资源文件ID
     */
    private Long fileId;

    /**
     * 文件ID
     */
    private String filePath;

    /**
     * 文件BASE64地址
     */
    private String base64Url;

    /**
     * 人脸照片
     */
    @JsonProperty(access = JsonProperty.Access.WRITE_ONLY)
    private MultipartFile file;

    /**
     * 高处作业证
     */
    private List<ResourceFileVo> highImgList;

    /**
     * 电工作业证
     */
    private List<ResourceFileVo> electricianImgList;

    /**
     * 其他作业证
     */
    private List<ResourceFileVo> elseImgList;

    /**
     * 删除高处作业证
     */
    private List<String> delHighFileIdList;

    /**
     * 删除电工作业证
     */
    private List<String> delElectFileIdList;

    /**
     * 删除其他作业证
     */
    private List<String> delElseFileIdList;

    /**
     * 岗位
     */
    @NotBlank(message = "人员岗位不能为空", groups = {Query.class})
    @Length(max = 32, message = "人员岗位字符长度不能超过32", groups = {Query.class})
    private String post;

    /**
     * 是否推送至人脸库 0.未推送 1.已推送
     */
    private Integer isPush = 0;

    /**
     * 查询条件限制
     */
    public interface Query {
    }


}
