package com.njcn.gather.system.dictionary.pojo.param;

import com.baomidou.mybatisplus.annotation.TableField;
import com.njcn.common.pojo.constant.PatternRegex;
import com.njcn.gather.system.pojo.constant.SystemValidMessage;
import io.swagger.annotations.ApiModelProperty;
import lombok.Data;
import lombok.EqualsAndHashCode;

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

/**
 * @author caozehui
 * @data 2024/11/8
 */
@Data
public class DictTreeParam {
    /**
     * 父id
     */
    @ApiModelProperty(value = "父id")
    private String pid;


    /**
     * 名称
     */
    @ApiModelProperty(value = "名称")
    @NotBlank(message = SystemValidMessage.NAME_NOT_BLANK)
    @Pattern(regexp = PatternRegex.DICT_NAME_REGEX, message = SystemValidMessage.DICT_TYPE_NAME_FORMAT_ERROR)
    private String name;

    /**
     * 编码
     */
    @ApiModelProperty(value = "编码")
    @TableField(value = "编码")
    @NotBlank(message = SystemValidMessage.CODE_NOT_BLANK)
    @Pattern(regexp = PatternRegex.DICT_CODE_REGEX, message = SystemValidMessage.DICT_TYPE_CODE_FORMAT_ERROR)
    private String code;

    /**
     * 用于区分多种类型的字典树 0.台账对象类型 1.自定义报表指标类型
     */
    @ApiModelProperty(value = "0.台账对象类型 1.自定义报表指标类型")
    private Integer type;

    /**
     * 根据type自定义内容，type:0用于区分对象类型是101电网侧 102用户侧
     */
    @ApiModelProperty(value = "根据type自定义内容，type:0用于区分对象类型是101电网侧 102用户侧")
    private String extend;

    /**
     * 排序
     */
    @ApiModelProperty(value = "排序")
    private Integer sort;

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


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


        @ApiModelProperty("id")
        @NotBlank(message = SystemValidMessage.ID_NOT_BLANK)
        @Pattern(regexp = PatternRegex.SYSTEM_ID, message = SystemValidMessage.ID_FORMAT_ERROR)
        private String id;
    }
}
