import type { PageParam } from '@/api';
import type { PageResult } from '@/api';

/**
 * 应用配置
 */
export interface CmsAppConfig {
  configId?: number;
  productId?: number;
  configKey?: string;
  configValue?: string;
  configType?: string;
  isEncrypted?: number;
  isSecret?: number;
  description?: string;
  sortNumber?: number;
  tenantId?: number;
  createdTime?: string;
  updatedTime?: string;
  deleted?: number;
}

/**
 * 应用配置查询参数
 */
export interface CmsAppConfigParam extends PageParam {
  configId?: number;
  productId?: number;
  configKey?: string;
  configType?: string;
  isSecret?: number;
}

/**
 * 批量保存请求
 */
export interface BatchSaveRequest {
  productId: number;
  configs: CmsAppConfig[];
}

/**
 * 配置类型定义
 */
export interface ConfigType {
  key: string;
  name: string;
  icon: string;
  description: string;
  configs: ConfigField[];
}

/**
 * 配置字段定义
 */
export interface ConfigField {
  key: string;
  label: string;
  type: 'input' | 'textarea' | 'number' | 'select' | 'switch' | 'password' | 'json';
  required?: boolean;
  placeholder?: string;
  options?: Array<{ label: string; value: any }>;
  defaultValue?: any;
  description?: string;
  secret?: boolean;
}
