import { CsvRate } from '../../entities/csv-rate.entity';

/**
 * CSV Rate Loader Port (Output Port)
 *
 * Interface for loading rates from CSV files.
 * Implemented by infrastructure layer.
 *
 * This port abstracts CSV file operations from the domain layer.
 */
export interface CsvRateLoaderPort {
  /**
   * Load all rates from a CSV file
   * @param filePath - Absolute or relative path to CSV file
   * @param companyEmail - Email address for the company (stored in config metadata)
   * @param companyNameOverride - Optional company name to override the one in CSV file
   * @returns Array of CSV rates
   * @throws Error if file cannot be read or parsed
   */
  loadRatesFromCsv(
    filePath: string,
    companyEmail: string,
    companyNameOverride?: string
  ): Promise<CsvRate[]>;

  /**
   * Load rates for a specific company
   * @param companyName - Name of the carrier company
   * @returns Array of CSV rates for the company
   */
  loadRatesByCompany(companyName: string): Promise<CsvRate[]>;

  /**
   * Validate CSV file structure without fully parsing
   * @param filePath - Path to CSV file
   * @returns Validation result with errors if any
   */
  validateCsvFile(filePath: string): Promise<{
    valid: boolean;
    errors: string[];
    rowCount?: number;
  }>;

  /**
   * Get list of all available CSV rate files
   * @returns Array of file paths
   */
  getAvailableCsvFiles(): Promise<string[]>;
}
