mirror of
https://github.com/Vikeo/LifeTrinket.git
synced 2025-11-14 23:17:59 +00:00
add zod validation
This commit is contained in:
@@ -1,9 +1,17 @@
|
||||
import { z } from 'zod';
|
||||
|
||||
export enum Orientation {
|
||||
OppositeLandscape = 'opposite-landscape',
|
||||
Landscape = 'landscape',
|
||||
Portrait = 'portrait',
|
||||
}
|
||||
|
||||
export enum GameFormat {
|
||||
Commander = 'commander',
|
||||
Standard = 'standard',
|
||||
TwoHeadedGiant = 'two-headed-giant',
|
||||
}
|
||||
|
||||
export type Settings = {
|
||||
keepAwake: boolean;
|
||||
showStartingPlayer: boolean;
|
||||
@@ -18,4 +26,10 @@ export type InitialGameSettings = {
|
||||
orientation: Orientation;
|
||||
};
|
||||
|
||||
type GameFormat = 'commander' | 'standard' | 'two-headed-giant';
|
||||
export const InitialGameSettingsSchema = z.object({
|
||||
startingLifeTotal: z.number().min(1).max(200).default(20),
|
||||
useCommanderDamage: z.boolean().default(false),
|
||||
gameFormat: z.nativeEnum(GameFormat).optional(),
|
||||
numberOfPlayers: z.number().min(1).max(6).default(2),
|
||||
orientation: z.nativeEnum(Orientation).default(Orientation.Landscape),
|
||||
});
|
||||
|
||||
Reference in New Issue
Block a user