package cn.pluss.platform.entity;

import cn.pluss.platform.config.mybatis.SqlConditionExtra;
import com.baomidou.mybatisplus.annotation.*;
import lombok.Data;
import lombok.EqualsAndHashCode;
import lombok.experimental.Accessors;

import javax.validation.constraints.NotEmpty;
import java.io.Serializable;
import java.util.Date;

/**
 * <p>
 * 身份证信息表, 图片信息在tb_pluss_merchant_image表中
 * </p>
 *
 * @author Djh
 * @since 2020-10-16
 */
@Data
@EqualsAndHashCode(callSuper = false)
@Accessors(chain = true)
@TableName("tb_pluss_id_card")
public class IdCard implements Serializable {

    public interface Common {}

    /** 实名人 */
    public static final String TYPE_CERT = "01";

    /** 结算人 */
    public static final String TYPE_ACCOUNT = "02";

    /** 法人 */
    public static final String TYPE_LEGAL = "03";

    private static final long serialVersionUID = 1L;

    /**
     * id
     */
    @TableId(value = "id", type = IdType.AUTO)
    private Integer id;


    @TableField("userId")
    private String userId;


    /**
     * 00身份证
     * 03军人证
     * 04警察证
     * 05港澳居民往来内地通行证
     * 06台湾居民来往大陆通行证
     * 07护照
     */
    @TableField("certType")
    private String certType;


    /**
     * 01 实名人; 02结算人; 03 法人
     */
    @NotEmpty(message = "缺少用户类型", groups = {IdCard.Common.class})
    @TableField("userType")
    private String userType;


    /**
     * 证件号
     */
    @NotEmpty(message = "请输入证件号", groups = {IdCard.Common.class})
    @TableField("certNo")
    private String certNo;


    /**
     * 证件姓名
     */
    @NotEmpty(message = "请输入证件人名称", groups = {IdCard.Common.class})
    @TableField("certName")
    private String certName;


    /**
     * 身份证有效期开始时间, yyyy-MM-dd
     */
    @NotEmpty(message = "请输入证件有效期开始时间", groups = {IdCard.Common.class})
    @TableField("certStartTime")
    private String certStartTime;


    /**
     * 身份证有效期结束时间, yyyy-MM-dd 或 长期
     */
    @NotEmpty(message = "请输入证件有效期结束时间", groups = {IdCard.Common.class})
    @TableField("certEndTime")
    private String certEndTime;


    /**
     * 身份证地址(暂无需求)
     */
    @TableField("certAddress")
    private String certAddress;

    /**
     * 创建时间
     */
    @TableField(value = "createTime", fill = FieldFill.INSERT)
    private Date createTime;

    /**
     * 创建时间 开始时间
     */
    @TableField(select = false, value = "createTime", condition = SqlConditionExtra.GT)
    private Date createTimeStart;

    /**
     * 创建时间 截止时间
     */
    @TableField(select = false, value = "createTime", condition = SqlConditionExtra.LT)
    private Date createTimeEnd;

    /**
     * 更新时间
     */
    @TableField(value = "updateTime", fill = FieldFill.INSERT_UPDATE)
    private Date updateTime;

    /**
     * 更新时间 开始时间
     */
    @TableField(select = false, value = "updateTime", condition = SqlConditionExtra.GT)
    private Date updateTimeStart;

    /**
     * 更新时间 截止时间
     */
    @TableField(select = false, value = "updateTime", condition = SqlConditionExtra.LT)
    private Date updateTimeEnd;

    /**
     * 身份证正面照片url
     */
    @NotEmpty(message = "缺少身份证正面照片", groups = {IdCard.Common.class})
    @TableField(value = "imgPositive", insertStrategy = FieldStrategy.NOT_EMPTY, updateStrategy = FieldStrategy.NOT_EMPTY)
    private String imgPositive;

    /**
     * 身份证反面照片url
     */
    @NotEmpty(message = "缺少身份证反面照片", groups = {IdCard.Common.class})
    @TableField(value = "imgNegative", insertStrategy = FieldStrategy.NOT_EMPTY, updateStrategy = FieldStrategy.NOT_EMPTY)
    private String imgNegative;
}