package com.njcn.device.pq.pojo.param;

import com.njcn.common.pojo.constant.PatternRegex;
import com.njcn.device.pq.pojo.constant.DeviceValidMessage;
import com.njcn.web.constant.ValidMessage;
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;

/**
 * 项目信息表，层次高于省级。
 *
 * @author hongawen
 * @since 2021-04-09
 */
@Data
@ApiModel
public class ProjectParam {

    /**
     * 项目名称（唯一性判断）
     */
    @ApiModelProperty(name = "name",value = "项目名称",required = true)
    @NotBlank(message= DeviceValidMessage.PROJECT_NAME_NOT)
    @Pattern(regexp = PatternRegex.DEPT_NAME_REGEX,message = DeviceValidMessage.PROJECT_NAME_RULE)
    private String name;

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

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

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


}
