add jury, bingo, leaderboard schemas to shared game types

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
This commit is contained in:
2026-03-12 19:45:32 +01:00
parent c31f849de3
commit 9ec0225e4b

View File

@@ -37,6 +37,57 @@ export const predictionSchema = z.object({
export type Prediction = z.infer<typeof predictionSchema>
// ─── Jury Voting ────────────────────────────────────────────────────
export const juryRoundSchema = z.object({
id: z.string(),
countryCode: z.string(),
countryName: z.string(),
countryFlag: z.string(),
status: z.enum(["open", "closed"]),
})
export type JuryRound = z.infer<typeof juryRoundSchema>
export const juryResultSchema = z.object({
countryCode: z.string(),
countryName: z.string(),
countryFlag: z.string(),
averageRating: z.number(),
totalVotes: z.number(),
})
export type JuryResult = z.infer<typeof juryResultSchema>
// ─── Bingo ──────────────────────────────────────────────────────────
export const bingoSquareSchema = z.object({
tropeId: z.string(),
label: z.string(),
tapped: z.boolean(),
})
export type BingoSquare = z.infer<typeof bingoSquareSchema>
export const bingoCardSchema = z.object({
squares: z.array(bingoSquareSchema).length(16),
hasBingo: z.boolean(),
})
export type BingoCard = z.infer<typeof bingoCardSchema>
// ─── Scoring ────────────────────────────────────────────────────────
export const leaderboardEntrySchema = z.object({
playerId: z.string(),
displayName: z.string(),
juryPoints: z.number(),
bingoPoints: z.number(),
totalPoints: z.number(),
})
export type LeaderboardEntry = z.infer<typeof leaderboardEntrySchema>
// ─── Game State (sent to clients) ───────────────────────────────────
export const gameStateSchema = z.object({
@@ -44,6 +95,18 @@ export const gameStateSchema = z.object({
myPrediction: predictionSchema.nullable(),
predictionsLocked: z.boolean(),
predictionSubmitted: z.record(z.string(), z.boolean()),
// Jury
currentJuryRound: juryRoundSchema.nullable(),
juryResults: z.array(juryResultSchema),
myJuryVote: z.number().nullable(),
// Bingo
myBingoCard: bingoCardSchema.nullable(),
bingoAnnouncements: z.array(z.object({
playerId: z.string(),
displayName: z.string(),
})),
// Leaderboard
leaderboard: z.array(leaderboardEntrySchema),
})
export type GameState = z.infer<typeof gameStateSchema>