package com.njcn.gather.system.dictionary.pojo.param;

import com.njcn.common.pojo.constant.PatternRegex;
import com.njcn.gather.system.pojo.constant.SystemValidMessage;
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
 * @data 2024/10/30 14:39
 */
@Data
public class DictTypeParam {

    @ApiModelProperty("名称")
    @NotBlank(message = SystemValidMessage.NAME_NOT_BLANK)
    @Pattern(regexp = PatternRegex.DICT_NAME_REGEX, message = SystemValidMessage.DICT_TYPE_NAME_FORMAT_ERROR)
    private String name;

    @ApiModelProperty("编码")
    @NotBlank(message = SystemValidMessage.CODE_NOT_BLANK)
    @Pattern(regexp = PatternRegex.DICT_CODE_REGEX, message = SystemValidMessage.DICT_TYPE_CODE_FORMAT_ERROR)
    private String code;


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


    @ApiModelProperty("开启等级：0-不开启；1-开启，默认不开启")
    @NotNull(message = SystemValidMessage.OPEN_LEVEL_NOT_NULL)
    @Min(value = 0, message = SystemValidMessage.OPEN_LEVEL_FORMAT_ERROR)
    @Max(value = 1, message = SystemValidMessage.OPEN_LEVEL_FORMAT_ERROR)
    private Integer openLevel;


    @ApiModelProperty("开启算法描述：0-不开启；1-开启，默认不开启")
    @NotNull(message = SystemValidMessage.OPEN_DESCRIBE_NOT_NULL)
    @Min(value = 0, message = SystemValidMessage.OPEN_DESCRIBE_FORMAT_ERROR)
    @Max(value = 1, message = SystemValidMessage.OPEN_DESCRIBE_FORMAT_ERROR)
    private Integer openDescribe;


    @ApiModelProperty("描述")
    private String remark;

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


        @ApiModelProperty("id")
        @NotBlank(message = SystemValidMessage.ID_NOT_BLANK)
        @Pattern(regexp = PatternRegex.SYSTEM_ID, message = SystemValidMessage.ID_FORMAT_ERROR)
        private String id;

    }

    /**
     * 分页查询实体
     */
    @Data
    @EqualsAndHashCode(callSuper = true)
    public static class QueryParam extends BaseParam {
        @ApiModelProperty("名称")
        private String name;

        @ApiModelProperty("编码")
        private String code;

    }

}

