package com.backendsys.modules.upload.entity;

import com.backendsys.entity.validator.RangeArray;
import com.baomidou.mybatisplus.annotation.IdType;
import com.baomidou.mybatisplus.annotation.TableField;
import com.baomidou.mybatisplus.annotation.TableId;
import com.baomidou.mybatisplus.annotation.TableName;
import jakarta.validation.Valid;
import jakarta.validation.constraints.NotBlank;
import jakarta.validation.constraints.NotEmpty;
import jakarta.validation.constraints.NotNull;
import jakarta.validation.constraints.Size;
import lombok.Data;
import org.hibernate.validator.constraints.Range;

import java.util.List;

@Data
@TableName("sys_file_category")
public class SysFileCategory {

    public static interface Create{}
    public static interface Update{}
    public static interface UpdateBatch{}
    public static interface Delete{}

    @TableId(type = IdType.AUTO)
    @NotNull(message="id 不能为空", groups = { Update.class, Delete.class })
    private Long id;

    private Long user_id;
    @Size(max = 50, message = "文件分类名称长度不超过 {max} 字符", groups = { Create.class, Update.class })
    @NotBlank(message="文件分类名称不能为空", groups = { Create.class, Update.class })
    private String category_name;

    @TableField(exist = false)
    private Integer category_file_count;

    @Range(min = 1, max = 9999, message = "排序必须在 {min} 到 {max} 之间", groups = { Create.class, Update.class })
    private Integer sort;
    @RangeArray(message="状态取值有误，范围应是(-1禁用, 1启用)", value = {"-1", "1"}, groups = { Create.class, Update.class })
    private Integer status;

    @TableField(exist = false)
    @NotNull(message="list 不能为空", groups = { UpdateBatch.class })
    private List<SysFileCategory> list;

}
