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

import cn.afterturn.easypoi.excel.annotation.Excel;
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 java.io.Serializable;
import java.util.Date;

import com.fasterxml.jackson.annotation.JsonFormat;
import com.fasterxml.jackson.annotation.JsonPropertyDescription;
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.validated.SaveValidated;
import com.gci.boot.common.validated.UpdateValidated;
import io.swagger.annotations.ApiModel;
import io.swagger.annotations.ApiModelProperty;
import lombok.Data;
import org.hibernate.validator.constraints.Length;
import org.springframework.format.annotation.DateTimeFormat;

import javax.validation.constraints.FutureOrPresent;
import javax.validation.constraints.NotBlank;
import javax.validation.constraints.NotNull;

/**
 * <p>
 * 客户培训
 * </p>
 *
 * @author 2464
 * @since 2023-10-12
 */
@Data
@TableName("tb_customer_training")
@ApiModel(value = "TbCustomerTraining对象", description = "客户培训")
public class TbCustomerTraining implements Serializable {

    private static final long serialVersionUID = 1L;

    @JsonPropertyDescription("主键id")
    @TableId(value = "id", type = IdType.ASSIGN_ID)
    @NotBlank(message = "编辑时id不能为空！",groups = {UpdateValidated.class})
    private String id;

    @JsonPropertyDescription("所属机构")
    private String sysOrgCode;

    @JsonPropertyDescription("创建时间")
    private Date createTime;

    @JsonPropertyDescription("更新时间")
    private Date updateTime;

    @JsonPropertyDescription("创建人")
    private String createBy;

    @JsonPropertyDescription("更新人")
    private String updateBy;

    @JsonPropertyDescription("所属项目")
    @NotBlank(message = "所属项目不能为空！",groups = {SaveValidated.class,UpdateValidated.class})
    @Length(max = 32,message = "所属项目id不能超过32位字符！",groups = {SaveValidated.class,UpdateValidated.class})
    @Dict(dicCode = "id",dictTable = "tb_projects",dicText = "project_name")
    @Excel(name = "所属项目",dict = "tb_projects,project_name,id")
    private String projectId;

    @JsonPropertyDescription("合同编号")
    @Length(max = 64,message = "合同编号不能超过64位字符！",groups = {SaveValidated.class,UpdateValidated.class, FromContract.class})
    @NotBlank(message = "对应合同编号不能为空！",groups = {FromContract.class})
    private String contractNo;

    @JsonPropertyDescription("预计开始时间")
    @JsonFormat(timezone = "GMT+8",pattern = "yyyy-MM-dd HH:mm:ss")
    @DateTimeFormat(pattern="yyyy-MM-dd HH:mm:ss")
    private Date expectedStartTime;

    @JsonPropertyDescription("培训名称")
    @Length(max = 64,message = "培训名称不能超过64位字符！",groups = {SaveValidated.class,UpdateValidated.class})
    @SelectQuery()
    private String trainingName;

    @JsonPropertyDescription("培训类型")
    @Length(max = 64,message = "培训类型不能超过64位字符！",groups = {SaveValidated.class,UpdateValidated.class,FromContract.class})
    @Excel(name = "培训类别")
    private String trainingType;

    @JsonPropertyDescription("培训对象")
    @Length(max = 64,message = "培训对象不能超过64位字符！",groups = {SaveValidated.class,UpdateValidated.class,FromContract.class})
    @Excel(name = "培训对象")
    private String trainees;

    @JsonPropertyDescription("实际开始时间")
    @JsonFormat(timezone = "GMT+8",pattern = "yyyy-MM-dd HH:mm:ss")
    @DateTimeFormat(pattern="yyyy-MM-dd HH:mm:ss")
    @Excel(name = "实际开始时间",format = "yyyy-MM-dd HH:mm:ss")
    private Date actualStartTime;

    @JsonPropertyDescription("培训结束时间")
    @JsonFormat(timezone = "GMT+8",pattern = "yyyy-MM-dd HH:mm:ss")
    @DateTimeFormat(pattern="yyyy-MM-dd HH:mm:ss")
    @Excel(name = "培训结束时间",format = "yyyy-MM-dd HH:mm:ss")
    private Date actualEndTime;

    @JsonPropertyDescription("授课人")
    @Length(max = 64,message = "授课人不能超过64位字符！",groups = {SaveValidated.class,UpdateValidated.class,FromContract.class})
    @Excel(name = "授课人")
    private String lecturer;

    @JsonPropertyDescription("授课内容")
    @Length(max = 1000,message = "授课内容不能超过1000位字符！",groups = {SaveValidated.class,UpdateValidated.class,FromContract.class})
    @Excel(name = "授课内容")
    private String teachingContent;

    @JsonPropertyDescription("附件")
    @FileUrl
    @JsonDeserialize(using = FileUrlHandle.class)
    private String attachment;

    @ApiModelProperty("持续时间")
    @TableField(exist = false)
    @Excel(name = "持续时间")
    private String duration;

    public interface FromContract {

    }
}
