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.Min;
import javax.validation.constraints.NotBlank;
import javax.validation.constraints.NotNull;
import javax.validation.constraints.Pattern;

/**
 * pqs
 *
 * @author cdf
 * @date 2021/6/24
 */
@Data
@ApiModel
public class ProvinceParam {


    @ApiModelProperty(name ="name",value = "省份",required = true)
    @NotBlank(message = DeviceValidMessage.PROVINCE_NAME_NOT)
    private String name;

    @ApiModelProperty(name = "sort",value = "排序",required = true)
    @NotNull(message = "排序不可为空")
    @Min(value = 0,message = "排序格式有误")
    private Integer sort;

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

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

}
