package com.chushang.inspection.project.po;

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.chushang.common.core.validator.Create;
import com.chushang.common.core.validator.Update;
import com.chushang.common.dict.annotation.DictFormat;
import com.chushang.common.mybatis.annotation.Condition;
import com.chushang.common.mybatis.base.BaseEntity;
import lombok.AllArgsConstructor;
import lombok.Data;
import lombok.EqualsAndHashCode;
import lombok.NoArgsConstructor;

import javax.validation.constraints.NotNull;
import java.time.LocalDateTime;
import java.util.List;

/**
 * @auther: zhao
 * @date: 2024/7/2 10:55
 */
@Data
@EqualsAndHashCode(callSuper=true)
@AllArgsConstructor
@NoArgsConstructor
@TableName(value = "sy_template")
public class Template extends BaseEntity {
    @NotNull(message = "模板id不能为空",groups = Update.class)
    @TableId(value = "template_id", type = IdType.ASSIGN_ID)
    @Condition(name = "template_id")
    private Long templateId;

    @NotNull(message = "模板名称不能为空",groups = {Create.class, Update.class})
    @TableField(value = "template_name")
    @Condition(name = "template_name", type = Condition.ConditionType.like)
    private String templateName;

    @NotNull(message = "模板fid不能为空",groups = {Create.class, Update.class})
    @TableField(value = "template_fid")
    @Condition(name = "template_fid")
    private String templateFid;
    @NotNull(message = "模板url不能为空",groups = {Create.class, Update.class})
    @TableField(value = "template_url")
    private String templateUrl;
    @NotNull(message = "模板alias不能为空",groups = {Create.class, Update.class})
    @TableField(value = "template_alias")
    @Condition(name = "template_alias")
    private String templateAlias;

    @TableField(value = "task_id")
    @Condition(name = "task_id")
    private Long taskId;

    @TableField(value = "task_name")
    private String taskName;
    @NotNull(message = "模板类型不能为空",groups = {Create.class, Update.class})
    @TableField(value = "template_type")
    @Condition(name = "template_type")
    @DictFormat(dictType = "template_type")
    private String templateType;

    @TableField(exist = false)
    @Condition(name = "create_time", type = Condition.ConditionType.between)
    private List<String> disposeTime;
}
