package com.ltgk.crew.domain.entity;

import com.baomidou.mybatisplus.annotation.*;
import com.baomidou.mybatisplus.extension.activerecord.Model;
import com.fasterxml.jackson.annotation.JsonFormat;
import com.ltgk.common.validation.groups.Add;
import com.ltgk.common.validation.groups.Detail;
import com.ltgk.common.validation.groups.Update;
import io.swagger.annotations.ApiModel;
import io.swagger.annotations.ApiModelProperty;
import lombok.Data;
import lombok.EqualsAndHashCode;
import lombok.experimental.Accessors;
import org.springframework.format.annotation.DateTimeFormat;

import javax.validation.constraints.NotBlank;
import javax.validation.constraints.NotNull;
import java.util.Date;

/**
 * 培训课程信息表
 *
 * @author Qi ChengBin
 * @date 2024/12/02 14:59:04
 */
@Data
@EqualsAndHashCode(callSuper = false)
@Accessors(chain = true)
@TableName("ds_crew_train_info")
@ApiModel(value = "培训课程信息对象", description = "培训课程信息表")
public class DsCrewTrainInfo extends Model<DsCrewTrainInfo> {

    private static final long serialVersionUID = 1L;

    @ApiModelProperty(value = "主键")
    @NotBlank(message = "培训课程主键信息不能为空", groups = {Update.class, Detail.class})
    @TableId(value = "id", type = IdType.ASSIGN_ID)
    private String id;

    @ApiModelProperty(value = "培训名称")
    @NotBlank(message = "培训名称不能为空", groups = {Update.class, Add.class})
    @TableField(value = "train_name", condition = SqlCondition.LIKE)
    private String trainName;


    @ApiModelProperty(value = "培训类型")
    @NotBlank(message = "培训类型不能为空", groups = {Update.class, Add.class})
    @TableField(value = "train_type", condition = SqlCondition.LIKE)
    private String trainType;

    @ApiModelProperty(value = "培训内容")
    @NotBlank(message = "培训内容不能为空", groups = {Update.class, Add.class})
    @TableField("train_content")
    private String trainContent;

    @ApiModelProperty(value = "培训结果")
    @TableField("train_result")
    private String trainResult;

    @ApiModelProperty(value = "培训开始时间")
    @NotNull(message = "培训开始时间不能为空", groups = {Update.class, Add.class})
    @TableField("train_start_time")
    @JsonFormat(pattern = "yyyy-MM-dd", timezone = "GMT+8")
    @DateTimeFormat(pattern = "yyyy-MM-dd")
    private Date trainStartTime;

    @ApiModelProperty(value = "培训时间结束时间")
    @NotNull(message = "培训结束时间不能为空", groups = {Update.class, Add.class})
    @TableField("train_end_time")
    @JsonFormat(pattern = "yyyy-MM-dd", timezone = "GMT+8")
    @DateTimeFormat(pattern = "yyyy-MM-dd")
    private Date trainEndTime;

    @ApiModelProperty(value = "培训人")
    @NotBlank(message = "培训人不能为空", groups = {Update.class, Add.class})
    @TableField(value = "trainer", condition = SqlCondition.LIKE)
    private String trainer;

    @ApiModelProperty(value = "参与人数")
    @NotNull(message = "参与人数不能为空", groups = {Update.class, Add.class})
    @TableField("part_num")
    private Integer partNum;

    @ApiModelProperty(value = "创建人")
    @TableField("create_by")
    private String createBy;

    @ApiModelProperty(value = "创建日期")
    @TableField("create_at")
    @JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss", timezone = "GMT+8")
    @DateTimeFormat(pattern = "yyyy-MM-dd HH:mm:ss")
    private Date createAt;

    @ApiModelProperty(value = "编辑人")
    @TableField("update_by")
    private String updateBy;

    @ApiModelProperty(value = "编辑日期")
    @TableField("update_at")
    @JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss", timezone = "GMT+8")
    @DateTimeFormat(pattern = "yyyy-MM-dd HH:mm:ss")
    private Date updateAt;

    @ApiModelProperty(value = "删除标志")
    @TableLogic
    @TableField("del_flag")
    private Integer delFlag;

    @ApiModelProperty(value = "备注")
    @TableField("remark")
    private String remark;

    @ApiModelProperty(value = "培训照片：一般3张")
    @NotBlank(message = "培训照片不能为空", groups = {Add.class})
    @TableField("photo")
    private String photo;

    @ApiModelProperty(value = "培训视频:最少一个")
    @NotBlank(message = "培训视频不能为空", groups = {Add.class})
    @TableField("video")
    private String video;

    @ApiModelProperty(value = "培训视频名称")
    @TableField(value = "video_name")
    private String videoName;

    @ApiModelProperty(value = "视频最小阅读时长")
    @NotNull(message = "视频最小阅读时长不能为空", groups = {Update.class, Add.class})
    @TableField("least_read_time")
    private Integer leastReadTime;

    @ApiModelProperty(value = "行政区域编码")
    @NotBlank(message = "行政区域编码不能为空", groups = {Update.class, Add.class})
    @TableField(value = "area_code")
    private String areaCode;

    @ApiModelProperty(value = "行政区域名称")
    @NotBlank(message = "行政区域名称不能为空", groups = {Update.class, Add.class})
    @TableField(value = "area_name")
    private String areaName;

    @ApiModelProperty(value = "是否有题目，0 - 没有； 1 - 有；默认没有题目")
    @TableField(value = "be_have_problem")
    private Integer beHaveProblem;

    @ApiModelProperty(value = "培训状态; 0 - 未通过，1 - 已通过")
    @TableField(exist = false)
    private Integer trainStatus;
}
