package com.backendsys.modules.system.entity;

import com.backendsys.entity.validator.RangeStringArray;
import com.baomidou.mybatisplus.annotation.IdType;
import com.baomidou.mybatisplus.annotation.TableId;
import com.baomidou.mybatisplus.annotation.TableName;
import jakarta.validation.constraints.NotNull;
import jakarta.validation.constraints.Size;
import lombok.Data;

@Data
@TableName("sys_common")
public class SysCommon {

    public static interface Detail{}
    public static interface Update{}

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

    @Size(max = 50, message = "配置名称长度不超过 {max} 个字符", groups = { Update.class })
    private String name;
    @Size(max = 500, message = "配置描述长度不超过 {max} 个字符", groups = { Update.class })
    private String description;
    private String tag;
    private String value;

    @RangeStringArray(message = "配置值类型取值有误，范围应是(String, Integer, Float)", value = { "String", "Integer", "Float" }, groups = { Update.class })
    private String value_type;
    @RangeStringArray(message = "配置组件取值有误，范围应是(Text, Textarea, Number, Radio, Checkbox, Select, Switch)", value = { "Text", "Textarea", "Number", "Radio", "Checkbox", "Select", "Switch" }, groups = { Update.class })
    private String value_component;

    private String value_option;
    private Integer max;
    @Size(max = 50, message = "分类长度不超过 {max} 个字符", groups = { Update.class })
    private String category;

    private Integer sort;
    private String create_time;

}
