package com.sckw.system.model.vo.req;

import com.sckw.core.web.request.PageReq;

import io.swagger.v3.oas.annotations.media.Schema;
import jakarta.validation.Valid;
import jakarta.validation.constraints.NotBlank;
import jakarta.validation.constraints.NotNull;
import jakarta.validation.constraints.Size;
import lombok.Data;
import lombok.EqualsAndHashCode;

import java.io.Serial;
import java.io.Serializable;


/**
 * 字典请求参数对象
 *
 * @author system
 * @date 2024
 */
@EqualsAndHashCode(callSuper = true)
@Data
@Schema(description = "字典请求参数对象")
public class SysDictReqVo extends PageReq implements Serializable {

    @Serial
    private static final long serialVersionUID = -1221233313543576005L;
    /**
     * 主键ID
     */
    @Schema(description = "主键ID")
    private Long id;

    /**
     * 字典实体
     */
    @Schema(description = "字典实体")
    @Valid
    private SysDictInfo entity;

    /**
     * 类型
     */
    @Schema(description = "类型")
    private String type;

    /**
     * 选项值
     */
    @Schema(description = "选项值")
    private String value;

    /**
     * 选项标签
     */
    @Schema(description = "选项标签")
    private String label;

    /**
     * 字典类型ID
     */
    @Schema(description = "字典类型ID")
    private Long dictId;

    /**
     * 父级ID
     */
    @Schema(description = "父级ID")
    private String parentId;

    /**
     * 状态
     */
    @Schema(description = "状态")
    private Integer status;

    /**
     * 搜索关键词（用于下拉搜索）
     */
    @Schema(description = "搜索关键词（用于下拉搜索）")
    private String keyword;

    @Data
    @Schema(description = "字典信息")
    public static class SysDictInfo implements Serializable {
        @Serial
        private static final long serialVersionUID = -2031642328618437889L;

        /**
         * 主键
         */
        @Schema(description = "主键")
        private Long id;

        /**
         * 字典类型id
         */
        @Schema(description = "字典类型id")
        @NotNull(message = "字典类型id不能为空")
        private Long dictId;

        /**
         * 字典值
         */
        @Schema(description = "字典值")
        @NotBlank(message = "字典值不能为空")
        private String value;

        /**
         * 选项
         */
        @Schema(description = "字典名称")
        @NotBlank(message = "字典名称不能为空")
        private String label;

        /**
         * 类型
         */
        @Schema(description = "类型")
        @NotBlank(message = "字典类型不能为空")
        private String type;

        /**
         * 描述
         */
        @Schema(description = "描述")
        private String description;

        /**
         * 排序（升序）
         */
        @Schema(description = "排序（升序）")
        @NotNull(message = "排序不能为空")
        private Long sort;

        /**
         * 父级编号
         */
        @Schema(description = "父级编号")
        private String parentId;

        /**
         * 备注
         */
        @Size(max = 200, message = "备注长度不能超过200")
        @Schema(description = "备注", maxLength = 200)
        private String remark;

    }
}
