package com.njcn.device.pq.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.ApiModel;
import io.swagger.annotations.ApiModelProperty;
import lombok.Data;
import lombok.EqualsAndHashCode;

import javax.validation.constraints.NotBlank;
import javax.validation.constraints.NotNull;
import javax.validation.constraints.Pattern;

/**
 * pqs
 *
 * @author cdf
 * @date 2022/1/14
 */
@Data
@ApiModel
public class NodeParam {

    /**
     * 名称
     */
    @ApiModelProperty(name = "name",value = "前置服务器名称")
    @NotBlank(message = "前置机名称不能为空")
    @Pattern(regexp = PatternRegex.DEV_NAME_REGEX, message = ValidMessage.NAME_FORMAT_ERROR)
    private String name;

    /**
     * 服务器IP
     */
    @ApiModelProperty(name = "ip",value = "服务器IP")
    @NotBlank(message = "前置机IP不能为空")
    @Pattern(regexp = PatternRegex.IP_REGEX, message = ValidMessage.IP_FORMAT_ERROR)
    private String ip;

    /**
     * 描述
     */
    @ApiModelProperty(name = "remark",value = "描述")
    private String remark;


    /**
     * 状态 前置等级
     */
    @ApiModelProperty(name = "nodeGrade",value = "前置等级")
    @NotNull(message = "前置机等级不可为空")
    private Integer nodeGrade;

    /**
     * 前置机支持最大装置数
     */
    @ApiModelProperty(name = "nodeDevNum",value = "前置机支持最大装置数")
    @NotNull(message = "前置机支持最大装置数不可为空")
    private Integer nodeDevNum;

    /**
     * 前置机支持最大进程数量
     */
    @ApiModelProperty(name = "nodeDevNum",value = "前置机支持最大进程数量")
    @NotNull(message = "前置机支持最大进程数量")
    private Integer maxProcessNum;

    /**
     * 排序
     */
    @ApiModelProperty(name = "sort",value = "排序")
    @NotNull(message = "排序不可为空")
    private Integer sort;

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

        /**
         * 表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 NodeQueryParam extends BaseParam {
        @ApiModelProperty("前置等级")
        private Integer nodeGrade;

    }
}
