package com.njcn.user.pojo.param;

import com.njcn.common.pojo.constant.PatternRegex;
import com.njcn.user.pojo.constant.UserValidMessage;
import com.njcn.web.constant.ValidMessage;
import io.swagger.annotations.ApiModelProperty;
import lombok.Data;
import lombok.EqualsAndHashCode;
import org.hibernate.validator.constraints.Range;

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

/**
 * 类的介绍：
 *
 * @author xuyang
 * @version 1.0.0
 * @createTime 2022/1/18 16:14
 */
@Data
public class HomePageParam {

    @ApiModelProperty("自定义页面名称")
    private String name;

    @ApiModelProperty("布局模板")
    @NotBlank(message = UserValidMessage.LAYOUT_NOT_BLANK)
    private String layout;

    @ApiModelProperty("路径")
    @NotBlank(message = UserValidMessage.PATH_NOT_BLANK)
    private String path;

    @ApiModelProperty("排序")
    @NotNull(message = UserValidMessage.SORT_NOT_BLANK)
    @Range(min = 0, max = 999, message = UserValidMessage.PARAM_FORMAT_ERROR)
    private Integer sort;

    @ApiModelProperty("图标")
    private String icon;

    /**
     * 首页操作实体
     * 需要填写的参数：首页的id
     */
    @Data
    @EqualsAndHashCode(callSuper = true)
    public static class HomePageUpdateParam extends HomePageParam {

        @ApiModelProperty("首页Id")
        @NotBlank(message = UserValidMessage.ID_NOT_BLANK)
        @Pattern(regexp = PatternRegex.SYSTEM_ID, message = ValidMessage.ID_FORMAT_ERROR)
        private String id;
    }





}
