package com.backendsys.modules.material.entity;

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.constraints.NotEmpty;
import jakarta.validation.constraints.NotNull;
import jakarta.validation.constraints.Size;
import lombok.Data;
import org.hibernate.validator.constraints.Range;

@Data
@TableName("ai_material_tag")
public class MaterialTag {

    public static interface TagList{}
    public static interface Detail{}
    public static interface Create{}
    public static interface Update{}
    public static interface Delete{}

    @TableId(type = IdType.AUTO)
    private Long id;

    @TableField("id")
    @NotNull(message="标签ID不能为空", groups = { Detail.class, Update.class, Delete.class })
    private Long tag_id;

    @NotNull(message="分类ID不能为空", groups = { TagList.class, Detail.class })
    private Long category_id;

    @Size(max = 100, message = "标签名称长度不超过 {max} 个字符", groups = { Create.class, Update.class })
    @NotEmpty(message="标签名称不能为空", groups = { Create.class, Update.class })
    private String tag_name;

    @TableField(exist = false)
    private Long material_count;

    @Range(min = 1, max = 9999, message = "排序必须在 {min} 到 {max} 之间")
    private Integer sort;

}
