import type { TeamsApiClient } from '../../api/teams/TeamsApiClient'; import type { TeamJoinRequestPresenter } from '../../presenters/TeamJoinRequestPresenter'; import type { TeamJoinRequestViewModel } from '../../view-models'; /** * Team Join Service * * Orchestrates team join/leave operations by coordinating API calls and presentation logic. * All dependencies are injected via constructor. */ export class TeamJoinService { constructor( private readonly apiClient: TeamsApiClient, private readonly teamJoinRequestPresenter: TeamJoinRequestPresenter ) {} /** * Get team join requests with presentation transformation */ async getJoinRequests(teamId: string, currentUserId: string, isOwner: boolean): Promise { try { const dto = await this.apiClient.getJoinRequests(teamId); return dto.requests.map(r => this.teamJoinRequestPresenter.present(r, currentUserId, isOwner)); } catch (error) { throw error; } } /** * Approve a team join request */ async approveJoinRequest(teamId: string, requestId: string): Promise { try { // TODO: implement API call when endpoint is available throw new Error('Not implemented: API endpoint for approving join requests'); } catch (error) { throw error; } } /** * Reject a team join request */ async rejectJoinRequest(teamId: string, requestId: string): Promise { try { // TODO: implement API call when endpoint is available throw new Error('Not implemented: API endpoint for rejecting join requests'); } catch (error) { throw error; } } }