package com.erp.dashboard.entity;

import com.baomidou.mybatisplus.annotation.*;
import lombok.AllArgsConstructor;
import lombok.Builder;
import lombok.Data;
import lombok.NoArgsConstructor;

import java.time.LocalDateTime;

/**
 * 系统配置实体 - 用于Dashboard限额配置读取
 */
@Data
@Builder
@NoArgsConstructor
@AllArgsConstructor
@TableName("system_configs")
public class SystemConfig {

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

    private String group;
    private String key;
    private String value;
    private String type;
    private String description;
    private Integer sort;
    private Integer status;

    @TableLogic
    private LocalDateTime deletedAt;

    @TableField(fill = FieldFill.INSERT)
    private LocalDateTime createdAt;

    @TableField(fill = FieldFill.INSERT_UPDATE)
    private LocalDateTime updatedAt;

    // 配置分组常量
    public static final String GROUP_TENANT_QUOTA = "tenant_quota";
    public static final String GROUP_STOCK_ALERT = "stock_alert_settings";

    // 配置键常量
    public static final String KEY_MONTHLY_ORDER_LIMIT = "monthly_order_limit";
    public static final String KEY_DAILY_API_LIMIT = "daily_api_limit";
    public static final String KEY_GLOBAL_THRESHOLD = "global_threshold";
}
