import { CsvBooking } from '../../entities/csv-booking.entity';

/**
 * CSV Booking Repository Port (Output Port)
 *
 * Interface for CSV booking persistence operations.
 * Implemented by infrastructure layer.
 *
 * This port abstracts database operations from the domain layer.
 */
export interface CsvBookingRepositoryPort {
  /**
   * Create a new booking
   * @param booking - Booking to create
   * @returns Created booking with generated ID
   */
  create(booking: CsvBooking): Promise<CsvBooking>;

  /**
   * Find booking by ID
   * @param id - Booking ID
   * @returns Booking if found, null otherwise
   */
  findById(id: string): Promise<CsvBooking | null>;

  /**
   * Find booking by confirmation token
   * @param token - Confirmation token from email link
   * @returns Booking if found, null otherwise
   */
  findByToken(token: string): Promise<CsvBooking | null>;

  /**
   * Find all bookings for a user
   * @param userId - User ID
   * @returns Array of bookings
   */
  findByUserId(userId: string): Promise<CsvBooking[]>;

  /**
   * Find all bookings for an organization
   * @param organizationId - Organization ID
   * @returns Array of bookings
   */
  findByOrganizationId(organizationId: string): Promise<CsvBooking[]>;

  /**
   * Find bookings by status
   * @param status - Booking status
   * @returns Array of bookings with matching status
   */
  findByStatus(status: string): Promise<CsvBooking[]>;

  /**
   * Find pending bookings that are about to expire
   * @param daysUntilExpiration - Number of days until expiration (e.g., 2)
   * @returns Array of bookings expiring soon
   */
  findExpiringSoon(daysUntilExpiration: number): Promise<CsvBooking[]>;

  /**
   * Update existing booking
   * @param booking - Booking with updated data
   * @returns Updated booking
   */
  update(booking: CsvBooking): Promise<CsvBooking>;

  /**
   * Delete booking
   * @param id - Booking ID
   */
  delete(id: string): Promise<void>;

  /**
   * Count bookings by status for a user
   * @param userId - User ID
   * @returns Object with counts per status
   */
  countByStatusForUser(userId: string): Promise<Record<string, number>>;

  /**
   * Count bookings by status for an organization
   * @param organizationId - Organization ID
   * @returns Object with counts per status
   */
  countByStatusForOrganization(organizationId: string): Promise<Record<string, number>>;
}
