package com.njcn.csdevice.pojo.param;

import com.njcn.common.pojo.constant.PatternRegex;
import com.njcn.db.bo.BaseEntity;
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 2023/5/31 14:54
 */
@Data
public class CsLedgerParam extends BaseEntity {

    @ApiModelProperty("Id")
    private String id;

    @ApiModelProperty("父Id")
    @NotBlank(message = "父Id不能为空")
    private String pid;

    @ApiModelProperty("名称")
    @NotBlank(message = "名称不能为空")
    private String name;

    @ApiModelProperty("等级")
    @NotNull(message = "等级不能为空")
    @Range(min = 0, max = 3, message = "参数类型错误")
    private Integer level;

    @ApiModelProperty("排序")
    @NotNull(message = "排序不能为空(默认为0)")
    private Integer sort;

    @ApiModelProperty("备注")
    private String remark;


    /**
     * 更新操作实体
     */
    @Data
    @EqualsAndHashCode(callSuper = true)
    public static class Update extends CsLedgerParam {
        @ApiModelProperty("台账表Id")
        @NotBlank(message = "台账表Id不能为空")
        @Pattern(regexp = PatternRegex.SYSTEM_ID, message = ValidMessage.ID_FORMAT_ERROR)
        private String id;

        private String pids;
    }


}
