export type LoadState = 'idle' | 'loading' | 'ready' | 'error';
export type AuthMode = 'login' | 'register' | 'external';
export type TaskSubmissionMode = 'simulation' | 'production';
export type TaskKind =
  | 'chat.completions'
  | 'responses'
  | 'embeddings'
  | 'reranks'
  | 'images.generations'
  | 'images.edits'
  | 'videos.generations'
  | 'tasks.retrieve';
export type PageKey = 'home' | 'playground' | 'models' | 'workspace' | 'admin' | 'docs';
export type PlaygroundMode = 'chat' | 'image' | 'video';
export type WorkspaceSection = 'overview' | 'billing' | 'apiKeys' | 'tasks' | 'transactions';
export type ApiDocSection =
  | 'openApiOverview'
  | 'compatApiOverview'
  | 'compatGemini'
  | 'compatKling'
  | 'compatVolces'
  | 'compatServerMain'
  | 'guideBaseUrl'
  | 'guideWebhook'
  | 'guideErrors'
  | 'guideTesting'
  | 'chat'
  | 'responses'
  | 'embeddings'
  | 'reranks'
  | 'imageGeneration'
  | 'imageEdit'
  | 'videoGeneration'
  | 'asyncMode'
  | 'taskRetrieve'
  | 'pricing'
  | 'files';
export type AdminSection =
  | 'overview'
  | 'globalModels'
  | 'baseModels'
  | 'pricing'
  | 'billingSettlements'
  | 'platforms'
  | 'realtimeLoad'
  | 'tasks'
  | 'tenants'
  | 'users'
  | 'userGroups'
  | 'auditLogs'
  | 'runtime'
  | 'systemSettings';

export interface LoginForm {
  account: string;
  password: string;
}

export interface RegisterForm {
  username: string;
  email: string;
  password: string;
  displayName: string;
  invitationCode: string;
}

export interface TaskForm {
  kind: TaskKind;
  model: string;
  prompt: string;
  aspectRatio?: string;
  dimensions?: number;
  documents?: string;
  duration?: number;
  image?: string;
  instructions?: string;
  mask?: string;
  outputAudio?: boolean;
  previousResponseId?: string;
  resolution?: string;
  taskId?: string;
  topN?: number;
}

export interface ApiKeyForm {
  name: string;
  expiresAt: string;
}

export interface WorkspaceTaskQuery {
  query: string;
  modelType: string;
  createdFrom: string;
  createdTo: string;
  page: number;
  pageSize: number;
}

export interface AdminTaskQuery {
  query: string;
  tenantId: string;
  userId: string;
  userGroupId: string;
  status: string;
  platformId: string;
  model: string;
  modelType: string;
  runMode: string;
  billingStatus: string;
  apiKey: string;
  createdFrom: string;
  createdTo: string;
  page: number;
  pageSize: number;
}

export interface WorkspaceTransactionQuery {
  query: string;
  createdFrom: string;
  createdTo: string;
  page: number;
  pageSize: number;
}

export interface PlatformForm {
  provider: string;
  platformKey: string;
  name: string;
  baseUrl: string;
  pricingRuleSetId: string;
  defaultDiscountFactor: string;
}

export interface PlatformModelForm {
  platformId: string;
  canonicalModelKey: string;
  modelName: string;
  providerModelName: string;
  modelAlias: string;
  modelType: string[];
  pricingRuleSetId: string;
  discountFactor: string;
}

export interface PlatformCreateInput {
  provider: string;
  platformKey?: string;
  name: string;
  internalName?: string;
  baseUrl?: string;
  authType?: string;
  credentials?: Record<string, unknown>;
  config?: Record<string, unknown>;
  retryPolicy?: Record<string, unknown>;
  rateLimitPolicy?: Record<string, unknown>;
  defaultPricingMode?: string;
  defaultDiscountFactor?: number;
  pricingRuleSetId?: string;
  priority?: number;
  status?: string;
}

export interface PlatformModelBindingInput {
  canonicalModelKey?: string;
  baseModelId?: string;
  modelName: string;
  providerModelName?: string;
  modelAlias?: string;
  modelType: string[];
  displayName?: string;
  pricingMode?: string;
  retryPolicy?: Record<string, unknown>;
  rateLimitPolicy?: Record<string, unknown>;
  rateLimitPolicyMode?: 'inherit' | 'override';
  runtimePolicySetId?: string;
  runtimePolicyOverride?: Record<string, unknown>;
  pricingRuleSetId?: string;
  discountFactor?: number;
}

export interface PlatformWithModelsInput {
  platformId?: string;
  platform: PlatformCreateInput;
  models: PlatformModelBindingInput[];
  selectionMode: 'all' | 'partial';
}
