Files
lolympus-tournament-support/packages/contracts/src/match.ts
T

131 lines
2.8 KiB
TypeScript

import type { CompetitionPhase } from "./competition.js";
import type { CompetitionFormatType } from "./format.js";
import type {
CommunityId,
CompetitionId,
GameSlotId,
MatchId,
SeriesId,
TeamId,
UserId,
} from "./ids.js";
import type { IsoDateTime, SeriesProjection } from "./series.js";
export type MatchLifecycleStatus =
| "recruiting"
| "team-built"
| "in-progress"
| "finished";
export type MatchGameMode =
| "pair"
| "round-robin"
| "double-elimination";
export type MatchPosition = "TOP" | "JGL" | "MID" | "ADC" | "SUP";
export interface MatchCompetitionSummaryView {
id: CompetitionId;
phase: CompetitionPhase;
formatType: CompetitionFormatType;
}
export interface MatchPositionPreferenceView {
position: MatchPosition;
priority: number;
}
export interface MatchTierView {
queueType: string;
tier: string;
rank: string;
leaguePoints: number;
wins: number;
losses: number;
fetchedAt: IsoDateTime;
}
export interface MatchParticipantView {
userId: UserId;
gameName?: string;
tagLine?: string;
profileIconId?: number;
tier?: MatchTierView;
preferredPositions: MatchPositionPreferenceView[];
joinedAt: IsoDateTime;
excluded: boolean;
}
export interface MatchTeamMemberView {
userId: UserId;
assignedPosition: MatchPosition;
cost?: number;
}
export interface MatchTeamView {
teamIndex: number;
name: string;
captainUserId?: UserId;
members: MatchTeamMemberView[];
}
export interface MatchScheduleItemView {
time: string;
label: string;
}
/** Canonical wire DTO returned by both Match list and detail endpoints. */
export interface MatchDetailResponse {
_id: MatchId;
communityId: CommunityId;
competitionId?: CompetitionId;
shortCode?: string;
title: string;
description: string;
mapId: number;
status: MatchLifecycleStatus;
scheduledAt: IsoDateTime;
maxParticipants: number;
gameCount: number;
gameMode: MatchGameMode;
roundRobinMaxRounds?: number;
doubleEliminationResetFinalEnabled?: boolean;
hostUserId?: UserId;
participants: MatchParticipantView[];
teams: MatchTeamView[];
prizes: string[];
notices: string[];
schedule: MatchScheduleItemView[];
joined: boolean;
createdAt: IsoDateTime;
updatedAt: IsoDateTime;
}
export type MatchSummaryResponse = MatchDetailResponse;
export interface TeamTournamentCodeView {
gameSlotId: GameSlotId;
seriesId: SeriesId;
ordinal: number;
displayNumber: number;
state: "pending" | "reserved" | "used";
code: string | null;
expiresAt: IsoDateTime | null;
}
export interface TeamCompetitionViewResponse {
competitionId: CompetitionId;
revision: number;
phase: CompetitionPhase;
teamId: TeamId;
activeSeries: SeriesProjection[];
tournamentCodes: TeamTournamentCodeView[];
}
export interface MatchListResponse {
matches: MatchDetailResponse[];
total: number;
page: number;
limit: number;
}