/**
 * Port Repository Port
 *
 * Defines the interface for Port (maritime port) persistence operations.
 * This is a secondary port (output port) in hexagonal architecture.
 */

import { Port } from '../../entities/port.entity';

export const PORT_REPOSITORY = 'PortRepository';

export interface PortRepository {
  /**
   * Save a port entity
   */
  save(port: Port): Promise<Port>;

  /**
   * Save multiple port entities
   */
  saveMany(ports: Port[]): Promise<Port[]>;

  /**
   * Find port by UN LOCODE
   */
  findByCode(code: string): Promise<Port | null>;

  /**
   * Find multiple ports by codes
   */
  findByCodes(codes: string[]): Promise<Port[]>;

  /**
   * Search ports by query string (name, city, or code)
   * with optional country filter and limit
   */
  search(query: string, limit?: number, countryFilter?: string): Promise<Port[]>;

  /**
   * Find all active ports
   */
  findAllActive(): Promise<Port[]>;

  /**
   * Find all ports in a specific country
   */
  findByCountry(countryCode: string): Promise<Port[]>;

  /**
   * Count total ports
   */
  count(): Promise<number>;

  /**
   * Delete port by code
   */
  deleteByCode(code: string): Promise<void>;
}
