/**
 * 系统配置仓储接口
 */
export const SYSTEM_CONFIG_REPOSITORY = Symbol('SYSTEM_CONFIG_REPOSITORY');

export interface SystemConfigEntity {
  id: string;
  key: string;
  value: string;
  description: string | null;
  createdAt: Date;
  updatedAt: Date;
  updatedBy: string | null;
}

export interface ISystemConfigRepository {
  /**
   * 根据配置键获取配置
   */
  findByKey(key: string): Promise<SystemConfigEntity | null>;

  /**
   * 获取多个配置
   */
  findByKeys(keys: string[]): Promise<SystemConfigEntity[]>;

  /**
   * 获取所有配置
   */
  findAll(): Promise<SystemConfigEntity[]>;

  /**
   * 保存或更新配置
   */
  upsert(
    key: string,
    value: string,
    description?: string,
    updatedBy?: string,
  ): Promise<SystemConfigEntity>;

  /**
   * 批量保存或更新配置
   */
  batchUpsert(
    configs: Array<{
      key: string;
      value: string;
      description?: string;
    }>,
    updatedBy?: string,
  ): Promise<SystemConfigEntity[]>;

  /**
   * 删除配置
   */
  delete(key: string): Promise<void>;
}
