package com.gci.boot.modules.driver.entity;

import com.alibaba.excel.annotation.ExcelIgnore;
import com.alibaba.excel.annotation.ExcelProperty;
import com.baomidou.mybatisplus.annotation.IdType;
import com.baomidou.mybatisplus.annotation.TableField;
import com.baomidou.mybatisplus.annotation.TableId;
import com.baomidou.mybatisplus.annotation.TableName;
import com.fasterxml.jackson.annotation.JsonFormat;
import com.fasterxml.jackson.databind.annotation.JsonDeserialize;
import com.gci.boot.annotation.Query.SelectQuery;
import com.gci.boot.annotation.fileUrl.FileUrl;
import com.gci.boot.annotation.fileUrl.handle.FileUrlHandle;
import com.gci.boot.common.dict.annotation.Dict;
import com.gci.boot.common.dict.excel.DictConverter;

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

import com.alibaba.excel.annotation.format.DateTimeFormat;
import com.alibaba.excel.annotation.write.style.ColumnWidth;

import com.gci.boot.common.validated.SaveValidated;
import com.gci.boot.common.validated.UpdateValidated;
import io.swagger.annotations.ApiModel;
import io.swagger.annotations.ApiModelProperty;
import lombok.Getter;
import lombok.Setter;
import org.hibernate.validator.constraints.Range;

import javax.validation.constraints.Size;

/**
 * <p>
 * 司机档案
 * </p>
 *
 * @author xushuhan
 * @since 2023-09-04
 */
@Getter
@Setter
@TableName("tb_driver")
@ApiModel(value = "TbDriver对象", description = "")
@ColumnWidth(20)
public class TbDriver implements Serializable {

    private static final long serialVersionUID = 1L;

    @TableId(value = "id", type = IdType.ASSIGN_ID)
    @ExcelIgnore
    private String id;

    @ApiModelProperty("所属项目")
    @SelectQuery(Type = SelectQuery.SelectType.EQ)
    @ExcelProperty(value = "所属项目", converter = DictConverter.class, index = 0)
    @Dict(dictTable = "tb_projects", dicText = "project_name", dicCode = "id")
    private String projectId;

    @ApiModelProperty("姓名")
    @SelectQuery
    @ExcelProperty(value = "司机姓名", index = 1)
    private String name;

    @ApiModelProperty("性别（1男，0女）")
    @ExcelProperty(value = "性别", converter = DictConverter.class, index = 2)
    @Dict(dicCode = "sex")
    private String sex;

    @ApiModelProperty("电话")
    @ExcelProperty(value = "联系电话", index = 3)
    private String phone;

    @ApiModelProperty("身份证号码")
    @ExcelProperty(value = "身份证号码", index = 4)
    private String idCard;

    @ApiModelProperty("入职时间")
    @JsonFormat(timezone = "GMT+8",pattern = "yyyy-MM-dd")
    @DateTimeFormat("yyyy-MM-dd")
    @ExcelProperty(value = "入职日期", index = 5)
    private Date entryTime;

    @ApiModelProperty("入职状态（1在职，0离职）")
    @SelectQuery(Type = SelectQuery.SelectType.EQ)
    @ExcelProperty(value = "入职状态", converter = DictConverter.class, index = 6)
    @Dict(dicCode = "entry_status")
    private String entryStatus;

    @ApiModelProperty("地址")
    @ExcelIgnore
    private String address;

    @ApiModelProperty("司机照片")
    @ExcelIgnore
    @JsonDeserialize(using = FileUrlHandle.class)
    @FileUrl
    private String fileUrl;

    @ApiModelProperty("备注")
    @ExcelIgnore
    private String remark;

    @ApiModelProperty("所属机构")
    @Dict(dictTable = "sys_depart", dicCode = "org_code", dicText = "depart_name")
    @ExcelIgnore
    private String sysOrgCode;

    @ApiModelProperty("创建时间")
    @JsonFormat(timezone = "GMT+8",pattern = "yyyy-MM-dd HH:mm:ss")
    @DateTimeFormat("yyyy-MM-dd HH:mm:ss")
    @ExcelIgnore
    private Date createTime;

    @ApiModelProperty("更新时间")
    @JsonFormat(timezone = "GMT+8",pattern = "yyyy-MM-dd HH:mm:ss")
    @DateTimeFormat("yyyy-MM-dd HH:mm:ss")
    @ExcelIgnore
    private Date updateTime;

    @ApiModelProperty("创建人")
    @ExcelIgnore
    private String createBy;

    @ApiModelProperty("更新人")
    @ExcelIgnore
    private String updateBy;

    @ExcelIgnore
    @ApiModelProperty("删除标志")
    private Integer delFlag;

    @ApiModelProperty("状态(1启用，0禁用)")
    @Dict(dicCode = "status")
    @ExcelIgnore
    private String status;

    @JsonFormat(timezone = "GMT+8",pattern = "yyyy-MM-dd")
    @org.springframework.format.annotation.DateTimeFormat(pattern="yyyy-MM-dd")
    @TableField(exist = false)
    @ExcelIgnore
    private Date entryTimeStart;

    @JsonFormat(timezone = "GMT+8",pattern = "yyyy-MM-dd")
    @org.springframework.format.annotation.DateTimeFormat(pattern="yyyy-MM-dd")
    @TableField(exist = false)
    @ExcelIgnore
    private Date entryTimeEnd;

    @ApiModelProperty("用户ID")
    @ExcelIgnore
    private String userId;

    @ApiModelProperty("所属客户")
    @Dict(dictTable = "tb_customer_archives", dicCode = "id", dicText = "name")
    @ExcelIgnore
    private String customerId;


    @ApiModelProperty("所属公司")
    @SelectQuery(Type = SelectQuery.SelectType.LIKE)
    @ExcelProperty(value = "所属公司", index = 7)
    @Size(max = 64,message = "所属公司长度不能超过64位！",groups = {SaveValidated.class, UpdateValidated.class})
    private String company;
    @ApiModelProperty("员工类别")
    @SelectQuery(Type = SelectQuery.SelectType.LIKE)
    @ExcelProperty(value = "员工类别", index = 8)
    @Size(max = 64,message = "员工类别长度不能超过64位！",groups = {SaveValidated.class, UpdateValidated.class})
    private String employeeType;
    @ApiModelProperty("是否定位 0-否,1-是")
    @SelectQuery(Type = SelectQuery.SelectType.EQ)
    @ExcelProperty(value = "是否定位", converter = DictConverter.class, index = 9)
    @Dict(dicCode = "yes_no")
    private String isPosition;
    @ApiModelProperty("年龄")
    @SelectQuery(Type = SelectQuery.SelectType.EQ)
    @ExcelProperty(value = "年龄", index = 10)
    @Range(min = 18,max = 200,message = "年龄必须在18到200区间内！",groups = {SaveValidated.class,UpdateValidated.class})
    private Integer age;
    @ApiModelProperty("婚姻状况 未婚-1 已婚-2 离婚-3 丧偶-4")
    @SelectQuery(Type = SelectQuery.SelectType.EQ)
    @ExcelProperty(value = "婚姻状况", converter = DictConverter.class, index = 11)
    @Dict(dicCode = "marital_status")
    private String maritalStatus;
    @ApiModelProperty("子女数")
    @SelectQuery(Type = SelectQuery.SelectType.EQ)
    @ExcelProperty(value = "子女数", index = 12)
    @Range(min = 0,max = 200,message = "子女数必须在0到200区间内！",groups = {SaveValidated.class,UpdateValidated.class})
    private Integer childrens;
    @ApiModelProperty("档案号")
    @SelectQuery(Type = SelectQuery.SelectType.LIKE)
    @ExcelProperty(value = "档案号", index = 13)
    @Size(max = 64,message = "档案号长度不能超过64位！",groups = {SaveValidated.class, UpdateValidated.class})
    private String fileNumber;
}
