/**
 * Admin Types
 *
 * Type definitions for admin features.
 */

// API Key types
export interface ApiKey {
  id: string;
  userId: string;
  username: string;
  email: string;
  provider: string;
  name: string;
  maskedKey: string;
  isActive: boolean;
  createdAt: number;
  lastUsedAt?: number;
  usageCount: number;
}

export interface ApiKeyUsageRecord {
  taskId?: string;
  taskType?: string;
  model?: string;
  provider: string;
  creditsUsed?: number;
  createdAt: string;
}

// Audit Log types
export interface AuditLog {
  id: string;
  userId: string | null;
  username: string | null;
  action: string;
  resourceType: string | null;
  resourceId: string | null;
  ipAddress: string | null;
  createdAt: string;
}

export interface AuditLogDetail extends AuditLog {
  userAgent: string | null;
  details: Record<string, any> | null;
}

// Storage types
export interface StorageStats {
  totalCapacity: number;
  usedSpace: number;
  fileCount: number;
  usagePercent: number;
}

export interface StorageFile {
  id: string;
  path: string;
  size: number;
  userId: string;
  username?: string;
  projectId?: string;
  projectName?: string;
  createdAt: number;
}

export interface StorageUserRanking {
  userId: string;
  username: string;
  storageUsed: number;
  fileCount: number;
  rank: number;
}

// Model types
export interface Model {
  id: string;
  name: string;
  provider: string;
  type: string;
  enabled: boolean;
  isDefault?: boolean;
  capabilities?: Record<string, boolean>;
  resolutions?: any;
  durations?: any;
}

export interface Provider {
  id: string;
  name: string;
  enabled: boolean;
  models: string[];
}

// Pagination response
export interface PaginatedResponse<T> {
  items: T[];
  total: number;
  page: number;
  pageSize: number;
  totalPages: number;
}
