export interface RateEntry {
  mid: number;
  bid: number;
  ask: number;
}

export interface RateData {
  base: string;
  pricingMode: 'mid' | 'bidask';
  adjustmentPercent?: number;
  labels?: {
    mid?: { from?: string; to?: string };
    bidask?: { from?: string; to?: string };
  };
  sourceLabel: string;
  timestamp: string;
  rates: Record<string, RateEntry>;
}

export interface CurrencyInfo {
  code: string;
  name: string;
  flag: string;
  group: string;
}

export interface ConverterUiLabels {
  selectCurrency?: string;
  searchCurrency?: string;
  searchCurrencies?: string;
  amountInPattern?: string;
}

export interface ConverterUiConfig {
  groupLabels?: Record<string, string>;
  groupOrder?: string[];
  labels?: ConverterUiLabels;
}

declare global {
  interface Window {
    crtodayConverterCurrencies?: CurrencyInfo[];
    crtodayConverterUi?: ConverterUiConfig;
  }
}
