package com.backendsys.modules.b2c.good.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.constraints.NotEmpty;
import jakarta.validation.constraints.NotNull;
import lombok.Data;
import org.hibernate.validator.constraints.Range;

import java.util.List;

@Data
@TableName("b2c_good_category")
public class GoodCategory {
    public static interface Detail{}
    public static interface Create{}
    public static interface Update{}
    public static interface Delete{}

    @TableField(exist = false)
    private String lang;

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

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

    private Long parent_id;

    @TableField(exist = false)
    private String category_name;

    @TableField(exist = false)
    private String category_description;

    @TableField(exist = false)
    @NotEmpty(message="内容不能为空", groups = { Create.class, Update.class})
    private List<GoodCategoryI18n> translations;

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

    @RangeArray(message="商品分类状态取值有误，范围应是(-1禁用, 1启用)", value = {"-1", "1"}, groups = { Create.class, Update.class })
    private Integer status;
}
