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

import { Organization } from '../../entities/organization.entity';

export const ORGANIZATION_REPOSITORY = 'OrganizationRepository';

export interface OrganizationRepository {
  /**
   * Save an organization entity
   */
  save(organization: Organization): Promise<Organization>;

  /**
   * Find organization by ID
   */
  findById(id: string): Promise<Organization | null>;

  /**
   * Find organization by name
   */
  findByName(name: string): Promise<Organization | null>;

  /**
   * Find organization by SCAC (Standard Carrier Alpha Code)
   */
  findBySCAC(scac: string): Promise<Organization | null>;

  /**
   * Find all organizations
   */
  findAll(): Promise<Organization[]>;

  /**
   * Find all active organizations
   */
  findAllActive(): Promise<Organization[]>;

  /**
   * Find organizations by type (e.g., 'FREIGHT_FORWARDER', 'CARRIER')
   */
  findByType(type: string): Promise<Organization[]>;

  /**
   * Update an organization entity
   */
  update(organization: Organization): Promise<Organization>;

  /**
   * Delete organization by ID
   */
  deleteById(id: string): Promise<void>;

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