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

import type {
  TeamMembership,
  TeamJoinRequest,
} from '../types/TeamMembership';

export interface ITeamMembershipRepository {
  /**
   * Get membership for a driver in a team, or null if none exists.
   */
  getMembership(teamId: string, driverId: string): Promise<TeamMembership | null>;

  /**
   * Get the active team membership for a driver (if any).
   */
  getActiveMembershipForDriver(driverId: string): Promise<TeamMembership | null>;

  /**
   * Get all active members for a team.
   */
  getTeamMembers(teamId: string): Promise<TeamMembership[]>;

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

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

  /**
   * Count active members for a team.
   */
  countByTeamId(teamId: string): Promise<number>;

  /**
   * Get all join requests for a team.
   */
  getJoinRequests(teamId: string): Promise<TeamJoinRequest[]>;

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

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