package com.snack.server.module.category.dto.req;

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

import java.io.Serializable;

/**
 * 创建/更新分类请求
 */
@Data
@Schema(description = "创建/更新分类请求")
public class CategorySaveReq implements Serializable {

    /** 主键（更新时必填） */
    @Schema(description = "分类 ID（更新时必填）")
    private Long id;

    @NotBlank(message = "分类名称不能为空")
    @Size(max = 50, message = "分类名称最长 50 字")
    @Schema(description = "分类名称", example = "坚果炒货")
    private String name;

    @Schema(description = "父分类 ID，0 = 一级分类", example = "1")
    private Long parentId = 0L;

    @NotNull(message = "层级不能为空")
    @Schema(description = "层级：1 一级 / 2 二级 / 3 三级", example = "2")
    private Integer level;

    @Schema(description = "排序号（升序）", example = "1")
    private Integer sort = 0;

    @Schema(description = "分类图标 URL")
    private String icon;

    @Schema(description = "状态：0-禁用 1-启用", example = "1")
    private Integer status = 1;
}
