package com.njcn.system.pojo.param;

import com.njcn.common.pojo.constant.PatternRegex;
import com.njcn.web.constant.ValidMessage;
import com.njcn.web.pojo.param.BaseParam;
import io.swagger.annotations.ApiModelProperty;
import lombok.Data;
import lombok.EqualsAndHashCode;

import javax.validation.constraints.*;

/**
 * @author hongawen
 * @version 1.0.0
 * @date 2021年12月17日 15:49
 */
@Data
public class DictDataParam  {


    @ApiModelProperty("字典类型id")
    @NotBlank(message = ValidMessage.DICT_TYPE_ID_NOT_BLANK)
    @Pattern(regexp = PatternRegex.SYSTEM_ID, message = ValidMessage.DICT_TYPE_ID_FORMAT_ERROR)
    private String typeId;


    @ApiModelProperty("名称")
    @NotBlank(message = ValidMessage.NAME_NOT_BLANK)
    @Pattern(regexp = PatternRegex.DIC_REGEX, message = ValidMessage.NAME_FORMAT_ERROR)
    private String name;


    @ApiModelProperty("编码")
    @NotBlank(message = ValidMessage.CODE_NOT_BLANK)
    @Pattern(regexp = PatternRegex.DIC_REGEX, message = ValidMessage.CODE_FORMAT_ERROR)
    private String code;


    @ApiModelProperty("排序")
    @NotNull(message = ValidMessage.SORT_NOT_NULL)
    @Min(value = 0, message = ValidMessage.SORT_FORMAT_ERROR)
    @Max(value = 999, message = ValidMessage.SORT_FORMAT_ERROR)
    private Integer sort;


    @ApiModelProperty("事件等级：0-普通；1-中等；2-严重(默认为0)")
    private Integer level;

    @ApiModelProperty("与高级算法内部Id描述对应")
    private Integer algoDescribe;


    @ApiModelProperty("字典值,用于记录字典的计算值如10kV记录为 10")
    private String value;


    /**
     * 更新操作实体
     */
    @Data
    @EqualsAndHashCode(callSuper = true)
    public static class DictDataUpdateParam extends DictDataParam {

        /**
         * 表Id
         */
        @ApiModelProperty("id")
        @NotBlank(message = ValidMessage.ID_NOT_BLANK)
        @Pattern(regexp = PatternRegex.SYSTEM_ID, message = ValidMessage.ID_FORMAT_ERROR)
        private String id;
    }

    /**
     * 分页查询实体
     */
    @Data
    @EqualsAndHashCode(callSuper = true)
    public static class DictDataQueryParam extends BaseParam {



    }

    /**
     * 根据字典类型id分页查询字典数据
     */
    @Data
    @EqualsAndHashCode(callSuper = true)
    public static class DicTypeIdQueryParam extends BaseParam {
        @ApiModelProperty("字典类型id")
        @NotBlank(message = ValidMessage.DICT_TYPE_ID_NOT_BLANK)
        @Pattern(regexp = PatternRegex.SYSTEM_ID, message = ValidMessage.DICT_TYPE_ID_FORMAT_ERROR)
        private String typeId;

    }

}
