package cn.stylefeng.team.meta.modular.pojo.request;

import cn.stylefeng.roses.kernel.rule.annotation.ChineseDescription;
import cn.stylefeng.roses.kernel.rule.pojo.request.BaseRequest;
import jakarta.validation.constraints.NotBlank;
import jakarta.validation.constraints.NotNull;
import lombok.Data;
import lombok.EqualsAndHashCode;

import java.math.BigDecimal;
import java.util.List;

@EqualsAndHashCode(callSuper = true)
@Data
public class MetaModelRequest extends BaseRequest {

    @NotNull(message = "模型id不能为空", groups = {edit.class, delete.class, upgradeModel.class})
    @ChineseDescription("模型id")
    private Long metaModelId;

    @NotNull(message = "所属业务分类id不能为空", groups = {add.class, edit.class})
    @ChineseDescription("所属业务分类id")
    private Long businessCategoryId;

    @NotNull(message = "所属业务id不能为空", groups = {add.class, edit.class, page.class, getTotalModelAndFieldList.class})
    @ChineseDescription("所属业务id")
    private Long businessId;

    @NotBlank(message = "模型名称不能为空", groups = {add.class, edit.class})
    @ChineseDescription("模型名称")
    private String metaModelName;

    @NotBlank(message = "模型编码不能为空", groups = {add.class, edit.class})
    @ChineseDescription("模型编码")
    private String metaModelCode;

    @NotNull(message = "系统编码，这里用十进制存储，但是展示的时候是3位36进制的字符串，例如展示的时候可能显示：#AZZZ不能为空",
            groups = {add.class})
    @ChineseDescription("系统编码，这里用十进制存储，但是展示的时候是3位36进制的字符串，例如展示的时候可能显示：#AZZZ")
    private Integer systemCode;

    @ChineseDescription("系统编码，用于展示用的，例如：#A001")
    @NotBlank(message = "系统编码展示字段不能为空", groups = {add.class})
    private String systemCodeShow;

    @NotNull(message = "模型类型不能为空", groups = {add.class, edit.class})
    @ChineseDescription("模型类型：1-新建表，2-外部表")
    private Integer metaModelType;

    @ChineseDescription("关联的外部模型的id")
    private Long linkModelId;

    @NotBlank(message = "是否是主表不能为空", groups = {add.class, edit.class})
    @ChineseDescription("是否是主表：Y-是，N-否")
    private String mainFlag;

    @ChineseDescription("子表中关联主表主键id的字段编码，例如子表中的user_id属性")
    private String subTableFieldCode;

    @ChineseDescription("子表类型：1-一对一，2-一对多")
    private Integer subTableType;

    @ChineseDescription("项目描述")
    private String description;

    @ChineseDescription("排序")
    @NotNull(message = "排序不能为空", groups = {add.class, edit.class})
    private BigDecimal fldSort;

    @NotNull(message = "批量删除id集合不能为空", groups = batchDelete.class)
    @ChineseDescription("批量删除用的id集合")
    private List<Long> batchDeleteIdList;

    @ChineseDescription("查询子表的标识")
    private Boolean findSubFlag;

    public @interface upgradeModel {
    }

    public @interface getTotalModelAndFieldList {

    }

}
