export interface User {
  id: string;
  username: string;
  email: string;
  avatar?: string;
  credits: number;
  allowedMenus?: string[] | null;
}

export interface CreditRecord {
  id: string;
  type: 'consume' | 'recharge';
  amount: number;
  description: string;
  createdAt: string;
}

export type Industry = string;

export interface OptionGroup {
  name: string;
  options: string[];
}

export interface IndustryConfig {
  id: string;
  key: string;
  label: string;
  icon: string;
  description: string;
  skills: { key: string; label: string }[];
  optionGroups?: OptionGroup[];
  isActive: boolean;
  sortOrder: number;
}

export interface Project {
  id: string;
  name: string;
  industry: Industry;
  createdAt: string;
  updatedAt: string;
}

export type AspectRatio = '16:9' | '4:3' | '1:1' | '3:4' | '9:16' | '21:9' | string;
export type Resolution = '480p' | '720p' | '1080p' | string;

export type GenerationStatus =
  | 'optimizing'
  | 'prompt_optimized'
  | 'generating'
  | 'completed'
  | 'failed';

export interface MediaReference {
  url: string;
  type: 'image' | 'video';
  name: string;
}

export interface GenerationRecord {
  id: string;
  items:[],
  projectId: string;
  projectName: string;
  originalPrompt: string;
  optimizedPrompt?: string;
  duration?: number;
  genType?: number;
  aspectRatio?: AspectRatio;
  resolution?: Resolution;
  status: GenerationStatus;
  videoUrl?: string;
  references?: MediaReference[];
  textCreditsCost: number;
  textTokensUsed: number;
  creditsCost: number;
  videoTokensUsed: number;
  errorMessage?: string;
  createdAt: string;
  generatedAt?: string;
  imageSize: string;
  imageProportion: string;
  imagePx: string;
  imageUrl: string;
  
}

export interface OptimizeParams {
  prompt: string;
  duration: number;
  genType?: any;
  resolution?: string;
  aspectRatio?: string;
  references?: MediaReference[];
  idempotencyKey?: string;
  image_size?: any;
  image_proportion?: any;
  image_px?: any;
  video_duration?: number;
  video_ratio?: string;
  video_resolution?: string;
}

export interface GenerateParams {
  aspectRatio?: AspectRatio;
  resolution?: Resolution;
}

export interface OptimizeResult {
  optimizedPrompt: string;
  textCreditsCost: number;
  textTokensUsed: number;
  record: GenerationRecord;
}

export interface LoginParams {
  username: string;
  password: string;
}

// ── Admin Types ──────────────────────────────────────

export interface AdminUser {
  id: string;
  username: string;
  email: string;
  phone?: string;
  credits: number;
  isActive: boolean;
  isAdmin: boolean;
  userType: string;
  createdAt: string;
  lastLoginAt?: string;
}

export interface AdminStats {
  totalUsers: number;
  totalProjects: number;
  totalGenerations: number;
  totalRevenue: number;
  creditsConsumedToday: number;
}

export interface ModelConfig {
  id: string;
  name: string;
  provider: string;
  apiBase: string;
  apiKey: string;
  modelName: string;
  weight: number;
  maxTokens: number;
  temperature: number;
  isActive: boolean;
  priority: number;
}

export interface SystemConfig {
  id: string;
  key: string;
  value: string;
  description?: string;
}

export interface AdminNotification {
  id: string;
  title: string;
  content: string;
  type: string;
  isRead: boolean;
  createdAt: string;
}
