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.*;
import java.util.List;

/**
 * @author hany
 * @version 1.0.0
 * @date 2022/09/13
 */
@Data
public class EventTemplateParam {

    @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.DES64_REGEX, message = ValidMessage.CODE_FORMAT_ERROR)
    private String code;

    @ApiModelProperty("类型")
    private Integer type;

    @ApiModelProperty("字典树")
    private List<String> ids;

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

        /**
         * 表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 EventTemplateQueryParam extends BaseParam {
        /**
         * 区分监测点与区域报告
         */
        @NotNull(message = "type不能为空")
        private Integer type;
    }

    /**
     * 模板的相关关联
     */
    @Data
    public static class TemplateRelevancy {
        private String id;
        private List<String> idList;

    }

}
