/**
 * Type definitions for all job payloads across data service providers
 */

// Common result types
export interface JobResult {
  success: boolean;
  message: string;
}

export interface CountableJobResult extends JobResult {
  count: number;
}

// QM Provider Types
export interface SymbolSpiderJob {
  prefix: string | null; // null = root job (A-Z)
  depth: number; // 1=A, 2=AA, 3=AAA, etc.
  source: string; // 'qm'
  maxDepth?: number; // optional max depth limit
}

export interface CreateSessionsResult extends JobResult {
  // No additional fields needed
}

export interface SearchSymbolsResult extends CountableJobResult {
  symbols?: unknown[]; // First 10 symbols as sample
}

export interface SpiderSymbolSearchResult extends JobResult {
  symbolsFound: number;
  newSymbolsAdded: number;
  duplicatesSkipped: number;
  errors: number;
  depth: number;
  prefix: string | null;
}

// IB Provider Types
export interface FetchSessionResult extends JobResult {
  sessionData?: Record<string, string>;
}

export interface FetchExchangesResult extends CountableJobResult {
  exchanges?: unknown[];
}

export interface FetchSymbolsResult extends CountableJobResult {
  symbols?: unknown[];
}

export interface IBExchangesAndSymbolsResult extends JobResult {
  exchanges: FetchExchangesResult;
  symbols: FetchSymbolsResult;
}

// Proxy Provider Types
export interface ProxyInfo {
  host: string;
  port: number;
  protocol: 'http' | 'https' | 'socks4' | 'socks5';
  username?: string;
  password?: string;
  country?: string;
  city?: string;
  isValid?: boolean;
  lastChecked?: Date;
}

export interface FetchProxiesFromSourcesResult extends CountableJobResult {
  proxies?: ProxyInfo[];
  sources: string[];
}

export interface CheckProxyResult extends JobResult {
  proxy: ProxyInfo;
  responseTime?: number;
  error?: string;
}

// WebShare Provider Types
export interface FetchWebShareProxiesResult extends CountableJobResult {
  proxies?: ProxyInfo[];
  activeProxies: number;
  totalQuota: number;
  remainingQuota: number;
}

// No payload job types (for operations that don't need input)
export interface NoPayload {
  // Empty interface for operations that don't need payload
}
