import { z } from "zod"; import { GameShema } from "../game-shema.js"; import { DbShema } from "../db-shema.js"; import { PrepareGamesShema } from "../games/prepare-games-shema.js"; class registrationApiShema { // /registration/get-today-bookings public ZGetTodayBookings = { res: z.object({ bookings: z.array( z.object({ booking_id: z.number(), customer_phone: z.string().nullable(), customer_name: z.string().nullable(), customer_email: z.string().nullable(), game_id: z.string().nullable(), size: z.number(), booking_timestamp: z.string(), game_start: z.string(), game_end: z.string(), players_number: z.number(), }), ), freeBookingsNumber: z.number(), }), }; // public ZCreateSession = { req: z.object({ size: z.number(), players_number: z.number(), booking_id: z.number().optional(), }), }; // public ZPlayerAutocompleteByPhone = { req: z.object({ playerIdx: z.number(), phone: z.string(), }), res: z .object({ playerIdx: z.number(), player_id: DbShema.ZPlayers.shape.player_id, name: DbShema.ZPlayers.shape.name, phone: DbShema.ZPlayers.shape.phone, age: DbShema.ZPlayers.shape.age, }) .nullable(), }; // public ZRegisterPlayer = { req: z.object({ player_id: z.number().nullish(), idx: z.number(), name: z.string(), phone: z.string().nullable(), age: z.number(), isLate: z.boolean(), }), }; // public ZSubmitRegistration = { req: z.object({}), }; // public ZGame = z.object({ game_id: GameShema.Z_GAMES_TYPES, name: z.string(), active: z.boolean(), min_players_number: z.number().min(1).max(8), max_players_number: z.number().min(1).max(8), }); public ZGetGames = { res: z.array(this.ZGame), }; // public ZSelectNewGame = { req: z.object({ gameId: GameShema.Z_GAMES_TYPES, }), }; // public ZPrepareNewGameSettings = { req: z.object({ gameSettings: PrepareGamesShema.ZAllGamesSettings, }), }; // public ZPlayerIsReady = { req: z.object({ playerId: z.number() }), }; } export const RegistrationApiShema = new registrationApiShema();