/**
 * Application Port: ILeagueMembershipRepository
 *
 * Repository interface for league membership and join request operations.
 * This defines the persistence boundary for membership-related domain entities.
 */

import type {
  LeagueMembership,
  JoinRequest,
} from '../entities/LeagueMembership';

export interface ILeagueMembershipRepository {
  /**
   * Get membership for a driver in a league, or null if none exists.
   */
  getMembership(leagueId: string, driverId: string): Promise<LeagueMembership | null>;

  /**
   * Get all active members for a league.
   */
  getLeagueMembers(leagueId: string): Promise<LeagueMembership[]>;

  /**
   * Get all join requests for a league.
   */
  getJoinRequests(leagueId: string): Promise<JoinRequest[]>;

  /**
   * Persist a membership (create or update).
   */
  saveMembership(membership: LeagueMembership): Promise<LeagueMembership>;

  /**
   * Remove a membership for a driver in a league.
   */
  removeMembership(leagueId: string, driverId: string): Promise<void>;

  /**
   * Persist a join request (create or update).
   */
  saveJoinRequest(request: JoinRequest): Promise<JoinRequest>;

  /**
   * Remove a join request by its ID.
   */
  removeJoinRequest(requestId: string): Promise<void>;
}