export interface Exchange {
  id: string;
  code: string;
  name: string;
  country: string;
  currency: string;
  active: boolean;
  visible: boolean;
  created_at: string;
  updated_at: string;
}

export interface ExchangeWithMappings extends Exchange {
  provider_mapping_count: string;
  active_mapping_count: string;
  verified_mapping_count: string;
  providers: string | null;
  provider_mappings: ProviderMapping[];
}

export interface ProviderMapping {
  id: string;
  provider: string;
  provider_exchange_code: string;
  provider_exchange_name: string;
  master_exchange_id: string;
  country_code: string | null;
  currency: string | null;
  confidence: number;
  active: boolean;
  verified: boolean;
  auto_mapped: boolean;
  created_at: string;
  updated_at: string;
  master_exchange_code?: string;
  master_exchange_name?: string;
  master_exchange_active?: boolean;
}

export interface CreateExchangeRequest {
  code: string;
  name: string;
  country: string;
  currency: string;
  active?: boolean;
}

export interface UpdateExchangeRequest {
  name?: string;
  active?: boolean;
  visible?: boolean;
  country?: string;
  currency?: string;
}

export interface CreateProviderMappingRequest {
  provider: string;
  provider_exchange_code: string;
  provider_exchange_name?: string;
  master_exchange_id: string;
  country_code?: string;
  currency?: string;
  confidence?: number;
  active?: boolean;
  verified?: boolean;
}

export interface UpdateProviderMappingRequest {
  active?: boolean;
  verified?: boolean;
  confidence?: number;
  master_exchange_id?: string;
}

export interface ProviderExchange {
  provider_exchange_code: string;
  provider_exchange_name: string;
  country_code: string | null;
  currency: string | null;
  symbol_count: number | null;
  is_mapped?: boolean;
  mapped_to_exchange_id?: string | null;
  mapped_to_exchange_code?: string | null;
}

export interface ExchangeStats {
  total_exchanges: number;
  active_exchanges: number;
  countries: number;
  currencies: number;
  total_provider_mappings: number;
  active_provider_mappings: number;
  verified_provider_mappings: number;
  providers: number;
}

export interface ApiResponse<T = unknown> {
  success: boolean;
  data?: T;
  error?: string;
  message?: string;
  total?: number;
}
