From c2af2dffa2ffb819009566f0ace9fdfea5c50fd9 Mon Sep 17 00:00:00 2001 From: aronmal Date: Sun, 11 Jun 2023 22:09:36 +0200 Subject: [PATCH] Working ship placement --- leaky-ships/components/Gamefield/EventBar.tsx | 236 ++++-- .../components/Gamefield/Gamefield.tsx | 71 +- leaky-ships/components/Gamefield/Item.tsx | 7 +- leaky-ships/components/Gamefield/Ship.tsx | 34 + leaky-ships/components/Gamefield/Ships.tsx | 38 +- leaky-ships/components/Gamefield/Targets.tsx | 47 +- leaky-ships/hooks/useGameProps.ts | 54 +- leaky-ships/interfaces/frontend.ts | 36 +- leaky-ships/lib/utils/helpers.ts | 28 +- leaky-ships/lib/zodSchemas.ts | 14 + leaky-ships/pages/api/game/running.ts | 12 + leaky-ships/prisma/generated/zod/index.ts | 787 ++++++++++++++++-- leaky-ships/prisma/schema.prisma | 22 + leaky-ships/styles/App.scss | 50 +- 14 files changed, 1155 insertions(+), 281 deletions(-) create mode 100644 leaky-ships/components/Gamefield/Ship.tsx diff --git a/leaky-ships/components/Gamefield/EventBar.tsx b/leaky-ships/components/Gamefield/EventBar.tsx index ce10ab2..1bd01bb 100644 --- a/leaky-ships/components/Gamefield/EventBar.tsx +++ b/leaky-ships/components/Gamefield/EventBar.tsx @@ -1,9 +1,15 @@ import { EventBarModes } from "../../interfaces/frontend" import Item from "./Item" import { GameSettings } from "@components/Lobby/SettingsFrame/Setting" +import { + faSquare2, + faSquare3, + faSquare4, +} from "@fortawesome/pro-regular-svg-icons" import { faArrowRightFromBracket, faBroomWide, + faCheck, faComments, faEye, faEyeSlash, @@ -11,6 +17,7 @@ import { faPalette, faReply, faScribble, + faShip, faSparkles, faSwords, } from "@fortawesome/pro-solid-svg-icons" @@ -18,13 +25,13 @@ import { useDrawProps } from "@hooks/useDrawProps" import { useGameProps } from "@hooks/useGameProps" import { socket } from "@lib/socket" import { GamePropsSchema } from "@lib/zodSchemas" +import { useSession } from "next-auth/react" import { Dispatch, SetStateAction, useCallback, useEffect, useMemo, - useState, } from "react" export function setGameSetting( @@ -42,23 +49,35 @@ export function setGameSetting( } } -function EventBar({ - props: { setMode, clear }, -}: { - props: { - setMode: Dispatch> - clear: () => void - } -}) { - const [menu, setMenu] = useState("main") +function EventBar({ clear }: { clear: () => void }) { const { shouldHide, color } = useDrawProps() - const { payload, setSetting, full, setTarget } = useGameProps() - + const { data: session } = useSession() + const { + ships, + payload, + menu, + mode, + setSetting, + full, + setTarget, + setIsReady, + } = useGameProps() const gameSetting = useCallback( (payload: GameSettings) => setGameSetting(payload, setSetting, full), [full, setSetting] ) - + const setMenu = useCallback( + (menu: keyof EventBarModes) => useGameProps.setState({ menu }), + [] + ) + const setMode = useCallback( + (mode: number) => useGameProps.setState({ mode }), + [] + ) + const self = useMemo( + () => payload?.users.find((e) => e?.id === session?.user.id), + [payload?.users, session?.user.id] + ) const items = useMemo( () => ({ main: [ @@ -69,13 +88,21 @@ function EventBar({ setMenu("menu") }, }, - { - icon: faSwords, - text: "Attack", - callback: () => { - setMenu("attack") - }, - }, + payload?.game?.state === "running" + ? { + icon: faSwords, + text: "Attack", + callback: () => { + setMenu("actions") + }, + } + : { + icon: faShip, + text: "Ships", + callback: () => { + setMenu("actions") + }, + }, { icon: "pen", text: "Draw", @@ -92,14 +119,6 @@ function EventBar({ }, ], menu: [ - { - icon: faReply, - text: "Return", - iconColor: "#555", - callback: () => { - setMenu("main") - }, - }, { icon: faArrowRightFromBracket, text: "Leave", @@ -109,51 +128,84 @@ function EventBar({ }, }, ], - attack: [ - { - icon: faReply, - text: "Return", - iconColor: "#555", - callback: () => { - setMenu("main") - }, - }, - { - icon: "radar", - text: "Radar scan", - amount: 1, - callback: () => { - setMode(0) - setTarget((e) => ({ ...e, show: false })) - }, - }, - { - icon: "torpedo", - text: "Fire torpedo", - amount: 1, - callback: () => { - setMode(1) - setTarget((e) => ({ ...e, show: false })) - }, - }, - { - icon: "scope", - text: "Fire missile", - callback: () => { - setMode(3) - setTarget((e) => ({ ...e, show: false })) - }, - }, - ], + actions: + payload?.game?.state === "running" + ? [ + { + icon: "scope", + text: "Fire missile", + callback: () => { + setMode(3) + setTarget((e) => ({ ...e, show: false })) + }, + }, + { + icon: "torpedo", + text: "Fire torpedo", + amount: + 2 - + (self?.moves.filter( + (e) => e.action === "htorpedo" || e.action === "vtorpedo" + ).length ?? 0), + callback: () => { + setMode(1) + setTarget((e) => ({ ...e, show: false })) + }, + }, + { + icon: "radar", + text: "Radar scan", + amount: + 1 - + (self?.moves.filter((e) => e.action === "radar").length ?? 0), + callback: () => { + setMode(0) + setTarget((e) => ({ ...e, show: false })) + }, + }, + ] + : [ + { + icon: faSquare2, + text: "Minensucher", + amount: 1 - ships.filter((e) => e.size === 2).length, + callback: () => { + if (1 - ships.filter((e) => e.size === 2).length === 0) return + setMode(0) + }, + }, + { + icon: faSquare3, + text: "Kreuzer", + amount: 3 - ships.filter((e) => e.size === 3).length, + callback: () => { + if (3 - ships.filter((e) => e.size === 3).length === 0) return + setMode(1) + }, + }, + { + icon: faSquare4, + text: "Schlachtschiff", + amount: 2 - ships.filter((e) => e.size === 4).length, + callback: () => { + if (2 - ships.filter((e) => e.size === 4).length === 0) return + setMode(2) + }, + }, + { + icon: faCheck, + text: "Done", + disabled: mode >= 0, + callback: () => { + const i = payload?.users.findIndex( + (user) => session?.user?.id === user?.id + ) + if (!i) return + setIsReady({ isReady: true, i }) + }, + }, + ], draw: [ - { - icon: faReply, - text: "Return", - iconColor: "#555", - callback: () => { - setMenu("main") - }, - }, { icon: faBroomWide, text: "Clear", callback: clear }, { icon: faPalette, text: "Color", iconColor: color }, { @@ -165,14 +217,6 @@ function EventBar({ }, ], settings: [ - { - icon: faReply, - text: "Return", - iconColor: "#555", - callback: () => { - setMenu("main") - }, - }, { icon: faGlasses, text: "Spectators", @@ -209,22 +253,54 @@ function EventBar({ clear, color, gameSetting, + mode, payload?.game?.allowChat, payload?.game?.allowMarkDraw, payload?.game?.allowSpecials, payload?.game?.allowSpectators, + payload?.game?.state, + payload?.users, + self?.moves, + session?.user?.id, + setIsReady, + setMenu, setMode, setTarget, + ships, shouldHide, ] ) + useEffect(() => { + if ( + menu !== "actions" || + payload?.game?.state !== "starting" || + mode < 0 || + items.actions[mode].amount + ) + return + const index = items.actions.findIndex((e) => e.amount) + useGameProps.setState({ mode: index }) + }, [items.actions, menu, mode, payload?.game?.state]) + useEffect(() => { useDrawProps.setState({ enable: menu === "draw" }) }, [menu]) return (
+ {menu !== "main" && ( + { + setMenu("main") + }, + }} + > + )} {items[menu].map((e, i) => ( ))} diff --git a/leaky-ships/components/Gamefield/Gamefield.tsx b/leaky-ships/components/Gamefield/Gamefield.tsx index cc93e87..77638d9 100644 --- a/leaky-ships/components/Gamefield/Gamefield.tsx +++ b/leaky-ships/components/Gamefield/Gamefield.tsx @@ -10,11 +10,14 @@ import Targets from "@components/Gamefield/Targets" import { useDraw } from "@hooks/useDraw" import { useDrawProps } from "@hooks/useDrawProps" import { useGameProps } from "@hooks/useGameProps" +import useSocket from "@hooks/useSocket" +import { socket } from "@lib/socket" import { initlialMouseCursor, overlapsWithAnyBorder, isAlreadyHit, targetList, + shipProps, } from "@lib/utils/helpers" import { CSSProperties, useCallback } from "react" import { useEffect, useState } from "react" @@ -25,40 +28,61 @@ function Gamefield() { const [mouseCursor, setMouseCursor] = useState(initlialMouseCursor) const { + mode, hits, target, targetPreview, - DispatchHits, + ships, + addShip, + payload, + DispatchAction, setTarget, setTargetPreview, + full, } = useGameProps() - const [mode, setMode] = useState(0) + const { isConnected } = useSocket() + + useEffect(() => { + if (payload?.game?.id || !isConnected) return + socket.emit("update", full) + }, [full, payload?.game?.id, isConnected]) const settingTarget = useCallback( (isGameTile: boolean, x: number, y: number) => { - const list = targetList(targetPreview, mode) - if ( - !isGameTile || - !list.filter(({ x, y }) => !isAlreadyHit(x, y, hits)).length - ) - return - if (target.show && target.x == x && target.y == y) { - DispatchHits({ - type: "fireMissile", - payload: list.map(({ x, y }) => ({ - hit: isAlreadyHit(x, y, hits), - x, - y, - })), - }) - setTarget((t) => ({ ...t, show: false })) - } else if (!overlapsWithAnyBorder(targetPreview, mode)) - setTarget({ show: true, x, y }) + if (payload?.game?.state === "running") { + const list = targetList(targetPreview, mode) + if ( + !isGameTile || + !list.filter(({ x, y }) => !isAlreadyHit(x, y, hits)).length + ) + return + if (target.show && target.x == x && target.y == y) { + DispatchAction({ + action: "missile", + ...target, + }) + setTarget((t) => ({ ...t, show: false })) + } else if (!overlapsWithAnyBorder(targetPreview, mode)) + setTarget({ show: true, x, y }) + } else if (payload?.game?.state === "starting") { + addShip(shipProps(ships, mode, targetPreview)) + } }, - [DispatchHits, hits, mode, setTarget, target, targetPreview] + [ + DispatchAction, + addShip, + hits, + mode, + payload?.game?.state, + setTarget, + ships, + target, + targetPreview, + ] ) useEffect(() => { + if (mode < 0) return const { x, y, show } = target const { shouldShow, ...position } = mouseCursor if (!shouldShow || overlapsWithAnyBorder(position, mode)) @@ -97,8 +121,7 @@ function Gamefield() { {/* Fog images */} {/* */} - - {/* Debug */} +
- + ) } diff --git a/leaky-ships/components/Gamefield/Item.tsx b/leaky-ships/components/Gamefield/Item.tsx index 9ed5274..d8dc550 100644 --- a/leaky-ships/components/Gamefield/Item.tsx +++ b/leaky-ships/components/Gamefield/Item.tsx @@ -45,11 +45,12 @@ function Item({ )}
{ + if (payload?.game?.state !== "starting") return + removeShip({ size, variant, x, y }) + useGameProps.setState({ mode: size - 2 }) + }} + > + {filename} +
+ ) +} + +export default Ship diff --git a/leaky-ships/components/Gamefield/Ships.tsx b/leaky-ships/components/Gamefield/Ships.tsx index 183e043..6b5bb96 100644 --- a/leaky-ships/components/Gamefield/Ships.tsx +++ b/leaky-ships/components/Gamefield/Ships.tsx @@ -1,31 +1,23 @@ -import { Ship } from "../../interfaces/frontend" -import classNames from "classnames" -import { CSSProperties } from "react" +import Ship from "./Ship" +import { useGameProps } from "@hooks/useGameProps" function Ships() { - const shipIndexes: Ship[] = [ - { size: 2, variant: 1, x: 3, y: 3 }, - { size: 3, variant: 1, x: 4, y: 3 }, - { size: 3, variant: 2, x: 5, y: 3 }, - { size: 3, variant: 3, x: 6, y: 3 }, - { size: 4, variant: 1, x: 7, y: 3 }, - { size: 4, variant: 2, x: 8, y: 3 }, - ] + // const shipIndexes: Ship[] = [ + // { size: 2, variant: 1, x: 3, y: 3 }, + // { size: 3, variant: 1, x: 4, y: 3 }, + // { size: 3, variant: 2, x: 5, y: 3 }, + // { size: 3, variant: 3, x: 6, y: 3 }, + // { size: 4, variant: 1, x: 7, y: 3 }, + // { size: 4, variant: 2, x: 8, y: 3 }, + // ] + + const { ships } = useGameProps() return ( <> - {shipIndexes.map(({ size, variant, x, y }, i) => { - const filename = `ship_blue_${size}x_${variant}.gif` - return ( -
- {filename} -
- ) - })} + {ships.map((props, i) => ( + + ))} ) } diff --git a/leaky-ships/components/Gamefield/Targets.tsx b/leaky-ships/components/Gamefield/Targets.tsx index 5f6a349..0199a75 100644 --- a/leaky-ships/components/Gamefield/Targets.tsx +++ b/leaky-ships/components/Gamefield/Targets.tsx @@ -1,30 +1,27 @@ -import { Hit, Target } from "../../interfaces/frontend" import GamefieldPointer from "./GamefieldPointer" -import { composeTargetTiles } from "@lib/utils/helpers" -import React from "react" +import Ship from "./Ship" +import { useGameProps } from "@hooks/useGameProps" +import { composeTargetTiles, shipProps } from "@lib/utils/helpers" -function Targets({ - props: { target, targetPreview, mode, hits }, -}: { - props: { - target: Target - targetPreview: Target - mode: number - hits: Hit[] - } -}) { - return ( - <> - {[ - ...composeTargetTiles(target, mode, hits).map((props, i) => ( - - )), - ...composeTargetTiles(targetPreview, mode, hits).map((props, i) => ( - - )), - ]} - - ) +function Targets() { + const { payload, target, targetPreview, mode, hits, ships } = useGameProps() + + if (payload?.game?.state === "running") + return ( + <> + {[ + ...composeTargetTiles(target, mode, hits).map((props, i) => ( + + )), + ...composeTargetTiles(targetPreview, mode, hits).map((props, i) => ( + + )), + ]} + + ) + + if (payload?.game?.state === "starting" && mode >= 0 && targetPreview.show) + return } export default Targets diff --git a/leaky-ships/hooks/useGameProps.ts b/leaky-ships/hooks/useGameProps.ts index c50e27d..b8fb22e 100644 --- a/leaky-ships/hooks/useGameProps.ts +++ b/leaky-ships/hooks/useGameProps.ts @@ -1,4 +1,10 @@ -import { Hit, HitDispatch, Target } from "../interfaces/frontend" +import { + ActionDispatchProps, + EventBarModes, + Hit, + ShipProps, + Target, +} from "../interfaces/frontend" import { GameSettings } from "@components/Lobby/SettingsFrame/Setting" import { getPayloadwithChecksum } from "@lib/getPayloadwithChecksum" import { socket } from "@lib/socket" @@ -19,12 +25,18 @@ const initialState: optionalGamePropsSchema & { isReady: boolean isConnected: boolean }[] + menu: keyof EventBarModes + mode: number + ships: ShipProps[] hits: Hit[] target: Target targetPreview: Target } = { + menu: "actions", + mode: 0, payload: null, hash: null, + ships: [], hits: [], target: initlialTarget, targetPreview: initlialTargetPreview, @@ -37,7 +49,7 @@ const initialState: optionalGamePropsSchema & { export type State = typeof initialState export type Action = { - DispatchHits: (action: HitDispatch) => void + DispatchAction: (props: ActionDispatchProps) => void setTarget: (target: SetStateAction) => void setTargetPreview: (targetPreview: SetStateAction) => void setPlayer: (payload: { users: PlayerSchema[] }) => string | null @@ -46,6 +58,8 @@ export type Action = { leave: (cb: () => void) => void setIsReady: (payload: { i: number; isReady: boolean }) => void starting: () => void + addShip: (props: ShipProps) => void + removeShip: (props: ShipProps) => void setIsConnected: (payload: { i: number; isConnected: boolean }) => void reset: () => void } @@ -54,16 +68,16 @@ export const useGameProps = create()( devtools( (set) => ({ ...initialState, - DispatchHits: (action) => + DispatchAction: (action) => set( produce((state: State) => { - switch (action.type) { - case "fireMissile": - case "htorpedo": - case "vtorpedo": { - state.hits.push(...action.payload) - } - } + // switch (action.type) { + // case "fireMissile": + // case "htorpedo": + // case "vtorpedo": { + // state.hits.push(...action.payload) + // } + // } }) ), setTarget: (target) => @@ -82,6 +96,25 @@ export const useGameProps = create()( else state.targetPreview = targetPreview }) ), + addShip: (props) => + set( + produce((state: State) => { + state.ships.push(props) + }) + ), + removeShip: ({ size, variant, x, y }) => + set( + produce((state: State) => { + const indexToRemove = state.ships.findIndex( + (ship) => + ship.size === size && + ship.variant === variant && + ship.x === x && + ship.y === y + ) + state.ships.splice(indexToRemove, 1) + }) + ), setPlayer: (payload) => { let hash: string | null = null set( @@ -103,7 +136,6 @@ export const useGameProps = create()( return hash }, setSetting: (settings) => { - const payload = JSON.stringify(settings) let hash: string | null = null set( produce((state: State) => { diff --git a/leaky-ships/interfaces/frontend.ts b/leaky-ships/interfaces/frontend.ts index bd5e704..bb3cb05 100644 --- a/leaky-ships/interfaces/frontend.ts +++ b/leaky-ships/interfaces/frontend.ts @@ -1,4 +1,5 @@ import { IconDefinition } from "@fortawesome/pro-solid-svg-icons" +import { MoveType } from "@prisma/client" export interface Position { x: number @@ -16,7 +17,7 @@ export interface TargetList extends Position { } export interface Mode { pointerGrid: any[][] - type: string + type: MoveType } export interface ItemProps { icon: string | IconDefinition @@ -29,7 +30,7 @@ export interface ItemProps { export interface EventBarModes { main: ItemProps[] menu: ItemProps[] - attack: ItemProps[] + actions: ItemProps[] draw: ItemProps[] settings: ItemProps[] } @@ -40,29 +41,7 @@ export interface Hit extends Position { hit: boolean } -interface fireMissile { - type: "fireMissile" | "htorpedo" | "vtorpedo" - payload: { - x: number - y: number - hit: boolean - }[] -} -interface removeMissile { - type: "removeMissile" - payload: { - x: number - y: number - hit: boolean - } -} - -export type HitDispatch = fireMissile | removeMissile - -export interface Point { - x: number - y: number -} +export interface Point extends Position {} export interface DrawLineProps { currentPoint: Point @@ -74,7 +53,12 @@ export interface Draw extends DrawLineProps { ctx: CanvasRenderingContext2D } -export interface Ship extends Position { +export interface ShipProps extends Position { size: number variant: number } + +export interface ActionDispatchProps extends Position { + index?: number + action: MoveType +} diff --git a/leaky-ships/lib/utils/helpers.ts b/leaky-ships/lib/utils/helpers.ts index 93be435..5ab5466 100644 --- a/leaky-ships/lib/utils/helpers.ts +++ b/leaky-ships/lib/utils/helpers.ts @@ -1,13 +1,14 @@ import type { Hit, - HitDispatch, Mode, Position, + ShipProps, Target, TargetList, } from "../../interfaces/frontend" import { count } from "@components/Gamefield/Gamefield" import { PointerProps } from "@components/Gamefield/GamefieldPointer" +import { useGameProps } from "@hooks/useGameProps" export function borderCN(count: number, x: number, y: number) { if (x === 0) return "left" @@ -54,13 +55,6 @@ export function isAlreadyHit(x: number, y: number, hits: Hit[]) { return !!hits.filter((h) => h.x === x && h.y === y).length } -function isSet(x: number, y: number, targetList: TargetList[], show: boolean) { - return ( - !!targetList.filter((field) => x === field.x && y === field.y).length && - show - ) -} - export function targetList( { x: targetX, y: targetY }: Position, mode: number @@ -129,3 +123,21 @@ export const initlialMouseCursor = { x: 0, y: 0, } + +export const shipProps = ( + ships: ShipProps[], + mode: number, + targetPreview: Target +) => ({ + size: mode + 2, + variant: + ships + .filter((e) => e.size === mode + 2) + .sort((a, b) => a.variant - b.variant) + .reduce((prev, curr) => { + console.log(curr.variant - prev) + return curr.variant - prev < 2 ? curr.variant : prev + }, 0) + 1, + x: targetPreview.x - Math.floor((mode + 2) / 2), + y: targetPreview.y, +}) diff --git a/leaky-ships/lib/zodSchemas.ts b/leaky-ships/lib/zodSchemas.ts index 4556bf8..b7b854b 100644 --- a/leaky-ships/lib/zodSchemas.ts +++ b/leaky-ships/lib/zodSchemas.ts @@ -1,3 +1,4 @@ +import { ShipSchema } from "../prisma/generated/zod" import { GameState } from "@prisma/client" import { z } from "zod" @@ -18,6 +19,9 @@ export const PlayerSchema = z .object({ id: z.string(), index: z.number(), + action: z.string(), + x: z.number(), + y: z.number(), }) .array(), }) @@ -34,10 +38,20 @@ export const CreateSchema = z.object({ allowSpecials: z.boolean(), allowChat: z.boolean(), allowMarkDraw: z.boolean(), + ships: z + .object({ + id: z.string(), + size: z.number(), + variant: z.number(), + x: z.number(), + y: z.number(), + }) + .array(), }) .nullable(), gamePin: z.string().nullable(), users: PlayerSchema.array(), + activeIndex: z.number().optional(), }) export const GamePropsSchema = z.object({ diff --git a/leaky-ships/pages/api/game/running.ts b/leaky-ships/pages/api/game/running.ts index abaa08c..eaefae5 100644 --- a/leaky-ships/pages/api/game/running.ts +++ b/leaky-ships/pages/api/game/running.ts @@ -15,6 +15,15 @@ export const gameSelects = { allowSpecials: true, allowSpectators: true, state: true, + ships: { + select: { + id: true, + size: true, + variant: true, + x: true, + y: true, + }, + }, gamePin: { select: { pin: true, @@ -36,6 +45,9 @@ export const gameSelects = { select: { id: true, index: true, + action: true, + x: true, + y: true, }, }, user: { diff --git a/leaky-ships/prisma/generated/zod/index.ts b/leaky-ships/prisma/generated/zod/index.ts index 679fa70..08edf7b 100644 --- a/leaky-ships/prisma/generated/zod/index.ts +++ b/leaky-ships/prisma/generated/zod/index.ts @@ -18,10 +18,12 @@ export const GameScalarFieldEnumSchema = z.enum(['id','createdAt','updatedAt','s export const GamepinScalarFieldEnumSchema = z.enum(['id','createdAt','pin','gameId']); -export const MoveScalarFieldEnumSchema = z.enum(['id','createdAt','index','user_game_id']); +export const MoveScalarFieldEnumSchema = z.enum(['id','createdAt','index','action','x','y','user_game_id']); export const SessionScalarFieldEnumSchema = z.enum(['id','sessionToken','userId','expires']); +export const ShipScalarFieldEnumSchema = z.enum(['id','size','variant','x','y','gameId']); + export const SortOrderSchema = z.enum(['asc','desc']); export const TransactionIsolationLevelSchema = z.enum(['ReadUncommitted','ReadCommitted','RepeatableRead','Serializable']); @@ -36,6 +38,10 @@ export const GameStateSchema = z.enum(['lobby','starting','running','ended']); export type GameStateType = `${z.infer}` +export const MoveTypeSchema = z.enum(['radar','htorpedo','vtorpedo','missile']); + +export type MoveTypeType = `${z.infer}` + ///////////////////////////////////////// // MODELS ///////////////////////////////////////// @@ -105,6 +111,21 @@ export const VerificationTokenSchema = z.object({ export type VerificationToken = z.infer +///////////////////////////////////////// +// SHIP SCHEMA +///////////////////////////////////////// + +export const ShipSchema = z.object({ + id: z.string().cuid(), + size: z.number().int(), + variant: z.number().int(), + x: z.number().int(), + y: z.number().int(), + gameId: z.string(), +}) + +export type Ship = z.infer + ///////////////////////////////////////// // GAME SCHEMA ///////////////////////////////////////// @@ -154,9 +175,12 @@ export type User_Game = z.infer ///////////////////////////////////////// export const MoveSchema = z.object({ + action: MoveTypeSchema, id: z.string().cuid(), createdAt: z.coerce.date(), index: z.number().int(), + x: z.number().int(), + y: z.number().int(), user_game_id: z.string(), }) @@ -279,10 +303,33 @@ export const VerificationTokenSelectSchema: z.ZodType = z.object({ + game: z.union([z.boolean(),z.lazy(() => GameArgsSchema)]).optional(), +}).strict() + +export const ShipArgsSchema: z.ZodType = z.object({ + select: z.lazy(() => ShipSelectSchema).optional(), + include: z.lazy(() => ShipIncludeSchema).optional(), +}).strict(); + +export const ShipSelectSchema: z.ZodType = z.object({ + id: z.boolean().optional(), + size: z.boolean().optional(), + variant: z.boolean().optional(), + x: z.boolean().optional(), + y: z.boolean().optional(), + gameId: z.boolean().optional(), + game: z.union([z.boolean(),z.lazy(() => GameArgsSchema)]).optional(), +}).strict() + // GAME //------------------------------------------------------ export const GameIncludeSchema: z.ZodType = z.object({ + ships: z.union([z.boolean(),z.lazy(() => ShipFindManyArgsSchema)]).optional(), gamePin: z.union([z.boolean(),z.lazy(() => GamepinArgsSchema)]).optional(), users: z.union([z.boolean(),z.lazy(() => User_GameFindManyArgsSchema)]).optional(), _count: z.union([z.boolean(),z.lazy(() => GameCountOutputTypeArgsSchema)]).optional(), @@ -298,6 +345,7 @@ export const GameCountOutputTypeArgsSchema: z.ZodType = z.object({ + ships: z.boolean().optional(), users: z.boolean().optional(), }).strict(); @@ -310,6 +358,7 @@ export const GameSelectSchema: z.ZodType = z.object({ allowSpecials: z.boolean().optional(), allowChat: z.boolean().optional(), allowMarkDraw: z.boolean().optional(), + ships: z.union([z.boolean(),z.lazy(() => ShipFindManyArgsSchema)]).optional(), gamePin: z.union([z.boolean(),z.lazy(() => GamepinArgsSchema)]).optional(), users: z.union([z.boolean(),z.lazy(() => User_GameFindManyArgsSchema)]).optional(), _count: z.union([z.boolean(),z.lazy(() => GameCountOutputTypeArgsSchema)]).optional(), @@ -389,6 +438,9 @@ export const MoveSelectSchema: z.ZodType = z.object({ id: z.boolean().optional(), createdAt: z.boolean().optional(), index: z.boolean().optional(), + action: z.boolean().optional(), + x: z.boolean().optional(), + y: z.boolean().optional(), user_game_id: z.boolean().optional(), user_game: z.union([z.boolean(),z.lazy(() => User_GameArgsSchema)]).optional(), }).strict() @@ -651,6 +703,59 @@ export const VerificationTokenScalarWhereWithAggregatesInputSchema: z.ZodType DateTimeWithAggregatesFilterSchema),z.coerce.date() ]).optional(), }).strict(); +export const ShipWhereInputSchema: z.ZodType = z.object({ + AND: z.union([ z.lazy(() => ShipWhereInputSchema),z.lazy(() => ShipWhereInputSchema).array() ]).optional(), + OR: z.lazy(() => ShipWhereInputSchema).array().optional(), + NOT: z.union([ z.lazy(() => ShipWhereInputSchema),z.lazy(() => ShipWhereInputSchema).array() ]).optional(), + id: z.union([ z.lazy(() => StringFilterSchema),z.string() ]).optional(), + size: z.union([ z.lazy(() => IntFilterSchema),z.number() ]).optional(), + variant: z.union([ z.lazy(() => IntFilterSchema),z.number() ]).optional(), + x: z.union([ z.lazy(() => IntFilterSchema),z.number() ]).optional(), + y: z.union([ z.lazy(() => IntFilterSchema),z.number() ]).optional(), + gameId: z.union([ z.lazy(() => StringFilterSchema),z.string() ]).optional(), + game: z.union([ z.lazy(() => GameRelationFilterSchema),z.lazy(() => GameWhereInputSchema) ]).optional(), +}).strict(); + +export const ShipOrderByWithRelationInputSchema: z.ZodType = z.object({ + id: z.lazy(() => SortOrderSchema).optional(), + size: z.lazy(() => SortOrderSchema).optional(), + variant: z.lazy(() => SortOrderSchema).optional(), + x: z.lazy(() => SortOrderSchema).optional(), + y: z.lazy(() => SortOrderSchema).optional(), + gameId: z.lazy(() => SortOrderSchema).optional(), + game: z.lazy(() => GameOrderByWithRelationInputSchema).optional() +}).strict(); + +export const ShipWhereUniqueInputSchema: z.ZodType = z.object({ + id: z.string().cuid().optional() +}).strict(); + +export const ShipOrderByWithAggregationInputSchema: z.ZodType = z.object({ + id: z.lazy(() => SortOrderSchema).optional(), + size: z.lazy(() => SortOrderSchema).optional(), + variant: z.lazy(() => SortOrderSchema).optional(), + x: z.lazy(() => SortOrderSchema).optional(), + y: z.lazy(() => SortOrderSchema).optional(), + gameId: z.lazy(() => SortOrderSchema).optional(), + _count: z.lazy(() => ShipCountOrderByAggregateInputSchema).optional(), + _avg: z.lazy(() => ShipAvgOrderByAggregateInputSchema).optional(), + _max: z.lazy(() => ShipMaxOrderByAggregateInputSchema).optional(), + _min: z.lazy(() => ShipMinOrderByAggregateInputSchema).optional(), + _sum: z.lazy(() => ShipSumOrderByAggregateInputSchema).optional() +}).strict(); + +export const ShipScalarWhereWithAggregatesInputSchema: z.ZodType = z.object({ + AND: z.union([ z.lazy(() => ShipScalarWhereWithAggregatesInputSchema),z.lazy(() => ShipScalarWhereWithAggregatesInputSchema).array() ]).optional(), + OR: z.lazy(() => ShipScalarWhereWithAggregatesInputSchema).array().optional(), + NOT: z.union([ z.lazy(() => ShipScalarWhereWithAggregatesInputSchema),z.lazy(() => ShipScalarWhereWithAggregatesInputSchema).array() ]).optional(), + id: z.union([ z.lazy(() => StringWithAggregatesFilterSchema),z.string() ]).optional(), + size: z.union([ z.lazy(() => IntWithAggregatesFilterSchema),z.number() ]).optional(), + variant: z.union([ z.lazy(() => IntWithAggregatesFilterSchema),z.number() ]).optional(), + x: z.union([ z.lazy(() => IntWithAggregatesFilterSchema),z.number() ]).optional(), + y: z.union([ z.lazy(() => IntWithAggregatesFilterSchema),z.number() ]).optional(), + gameId: z.union([ z.lazy(() => StringWithAggregatesFilterSchema),z.string() ]).optional(), +}).strict(); + export const GameWhereInputSchema: z.ZodType = z.object({ AND: z.union([ z.lazy(() => GameWhereInputSchema),z.lazy(() => GameWhereInputSchema).array() ]).optional(), OR: z.lazy(() => GameWhereInputSchema).array().optional(), @@ -663,6 +768,7 @@ export const GameWhereInputSchema: z.ZodType = z.object({ allowSpecials: z.union([ z.lazy(() => BoolFilterSchema),z.boolean() ]).optional(), allowChat: z.union([ z.lazy(() => BoolFilterSchema),z.boolean() ]).optional(), allowMarkDraw: z.union([ z.lazy(() => BoolFilterSchema),z.boolean() ]).optional(), + ships: z.lazy(() => ShipListRelationFilterSchema).optional(), gamePin: z.union([ z.lazy(() => GamepinRelationFilterSchema),z.lazy(() => GamepinWhereInputSchema) ]).optional().nullable(), users: z.lazy(() => User_GameListRelationFilterSchema).optional() }).strict(); @@ -676,6 +782,7 @@ export const GameOrderByWithRelationInputSchema: z.ZodType SortOrderSchema).optional(), allowChat: z.lazy(() => SortOrderSchema).optional(), allowMarkDraw: z.lazy(() => SortOrderSchema).optional(), + ships: z.lazy(() => ShipOrderByRelationAggregateInputSchema).optional(), gamePin: z.lazy(() => GamepinOrderByWithRelationInputSchema).optional(), users: z.lazy(() => User_GameOrderByRelationAggregateInputSchema).optional() }).strict(); @@ -821,6 +928,9 @@ export const MoveWhereInputSchema: z.ZodType = z.object({ id: z.union([ z.lazy(() => StringFilterSchema),z.string() ]).optional(), createdAt: z.union([ z.lazy(() => DateTimeFilterSchema),z.coerce.date() ]).optional(), index: z.union([ z.lazy(() => IntFilterSchema),z.number() ]).optional(), + action: z.union([ z.lazy(() => EnumMoveTypeFilterSchema),z.lazy(() => MoveTypeSchema) ]).optional(), + x: z.union([ z.lazy(() => IntFilterSchema),z.number() ]).optional(), + y: z.union([ z.lazy(() => IntFilterSchema),z.number() ]).optional(), user_game_id: z.union([ z.lazy(() => StringFilterSchema),z.string() ]).optional(), user_game: z.union([ z.lazy(() => User_GameRelationFilterSchema),z.lazy(() => User_GameWhereInputSchema) ]).optional(), }).strict(); @@ -829,19 +939,26 @@ export const MoveOrderByWithRelationInputSchema: z.ZodType SortOrderSchema).optional(), createdAt: z.lazy(() => SortOrderSchema).optional(), index: z.lazy(() => SortOrderSchema).optional(), + action: z.lazy(() => SortOrderSchema).optional(), + x: z.lazy(() => SortOrderSchema).optional(), + y: z.lazy(() => SortOrderSchema).optional(), user_game_id: z.lazy(() => SortOrderSchema).optional(), user_game: z.lazy(() => User_GameOrderByWithRelationInputSchema).optional() }).strict(); export const MoveWhereUniqueInputSchema: z.ZodType = z.object({ id: z.string().cuid().optional(), - user_game_id_index: z.lazy(() => MoveUser_game_idIndexCompoundUniqueInputSchema).optional() + user_game_id_index: z.lazy(() => MoveUser_game_idIndexCompoundUniqueInputSchema).optional(), + action_x_y: z.lazy(() => MoveActionXYCompoundUniqueInputSchema).optional() }).strict(); export const MoveOrderByWithAggregationInputSchema: z.ZodType = z.object({ id: z.lazy(() => SortOrderSchema).optional(), createdAt: z.lazy(() => SortOrderSchema).optional(), index: z.lazy(() => SortOrderSchema).optional(), + action: z.lazy(() => SortOrderSchema).optional(), + x: z.lazy(() => SortOrderSchema).optional(), + y: z.lazy(() => SortOrderSchema).optional(), user_game_id: z.lazy(() => SortOrderSchema).optional(), _count: z.lazy(() => MoveCountOrderByAggregateInputSchema).optional(), _avg: z.lazy(() => MoveAvgOrderByAggregateInputSchema).optional(), @@ -857,6 +974,9 @@ export const MoveScalarWhereWithAggregatesInputSchema: z.ZodType StringWithAggregatesFilterSchema),z.string() ]).optional(), createdAt: z.union([ z.lazy(() => DateTimeWithAggregatesFilterSchema),z.coerce.date() ]).optional(), index: z.union([ z.lazy(() => IntWithAggregatesFilterSchema),z.number() ]).optional(), + action: z.union([ z.lazy(() => EnumMoveTypeWithAggregatesFilterSchema),z.lazy(() => MoveTypeSchema) ]).optional(), + x: z.union([ z.lazy(() => IntWithAggregatesFilterSchema),z.number() ]).optional(), + y: z.union([ z.lazy(() => IntWithAggregatesFilterSchema),z.number() ]).optional(), user_game_id: z.union([ z.lazy(() => StringWithAggregatesFilterSchema),z.string() ]).optional(), }).strict(); @@ -1204,6 +1324,68 @@ export const VerificationTokenUncheckedUpdateManyInputSchema: z.ZodType DateTimeFieldUpdateOperationsInputSchema) ]).optional(), }).strict(); +export const ShipCreateInputSchema: z.ZodType = z.object({ + id: z.string().cuid().optional(), + size: z.number().int(), + variant: z.number().int(), + x: z.number().int(), + y: z.number().int(), + game: z.lazy(() => GameCreateNestedOneWithoutShipsInputSchema) +}).strict(); + +export const ShipUncheckedCreateInputSchema: z.ZodType = z.object({ + id: z.string().cuid().optional(), + size: z.number().int(), + variant: z.number().int(), + x: z.number().int(), + y: z.number().int(), + gameId: z.string() +}).strict(); + +export const ShipUpdateInputSchema: z.ZodType = z.object({ + id: z.union([ z.string().cuid(),z.lazy(() => StringFieldUpdateOperationsInputSchema) ]).optional(), + size: z.union([ z.number().int(),z.lazy(() => IntFieldUpdateOperationsInputSchema) ]).optional(), + variant: z.union([ z.number().int(),z.lazy(() => IntFieldUpdateOperationsInputSchema) ]).optional(), + x: z.union([ z.number().int(),z.lazy(() => IntFieldUpdateOperationsInputSchema) ]).optional(), + y: z.union([ z.number().int(),z.lazy(() => IntFieldUpdateOperationsInputSchema) ]).optional(), + game: z.lazy(() => GameUpdateOneRequiredWithoutShipsNestedInputSchema).optional() +}).strict(); + +export const ShipUncheckedUpdateInputSchema: z.ZodType = z.object({ + id: z.union([ z.string().cuid(),z.lazy(() => StringFieldUpdateOperationsInputSchema) ]).optional(), + size: z.union([ z.number().int(),z.lazy(() => IntFieldUpdateOperationsInputSchema) ]).optional(), + variant: z.union([ z.number().int(),z.lazy(() => IntFieldUpdateOperationsInputSchema) ]).optional(), + x: z.union([ z.number().int(),z.lazy(() => IntFieldUpdateOperationsInputSchema) ]).optional(), + y: z.union([ z.number().int(),z.lazy(() => IntFieldUpdateOperationsInputSchema) ]).optional(), + gameId: z.union([ z.string(),z.lazy(() => StringFieldUpdateOperationsInputSchema) ]).optional(), +}).strict(); + +export const ShipCreateManyInputSchema: z.ZodType = z.object({ + id: z.string().cuid().optional(), + size: z.number().int(), + variant: z.number().int(), + x: z.number().int(), + y: z.number().int(), + gameId: z.string() +}).strict(); + +export const ShipUpdateManyMutationInputSchema: z.ZodType = z.object({ + id: z.union([ z.string().cuid(),z.lazy(() => StringFieldUpdateOperationsInputSchema) ]).optional(), + size: z.union([ z.number().int(),z.lazy(() => IntFieldUpdateOperationsInputSchema) ]).optional(), + variant: z.union([ z.number().int(),z.lazy(() => IntFieldUpdateOperationsInputSchema) ]).optional(), + x: z.union([ z.number().int(),z.lazy(() => IntFieldUpdateOperationsInputSchema) ]).optional(), + y: z.union([ z.number().int(),z.lazy(() => IntFieldUpdateOperationsInputSchema) ]).optional(), +}).strict(); + +export const ShipUncheckedUpdateManyInputSchema: z.ZodType = z.object({ + id: z.union([ z.string().cuid(),z.lazy(() => StringFieldUpdateOperationsInputSchema) ]).optional(), + size: z.union([ z.number().int(),z.lazy(() => IntFieldUpdateOperationsInputSchema) ]).optional(), + variant: z.union([ z.number().int(),z.lazy(() => IntFieldUpdateOperationsInputSchema) ]).optional(), + x: z.union([ z.number().int(),z.lazy(() => IntFieldUpdateOperationsInputSchema) ]).optional(), + y: z.union([ z.number().int(),z.lazy(() => IntFieldUpdateOperationsInputSchema) ]).optional(), + gameId: z.union([ z.string(),z.lazy(() => StringFieldUpdateOperationsInputSchema) ]).optional(), +}).strict(); + export const GameCreateInputSchema: z.ZodType = z.object({ id: z.string().cuid().optional(), createdAt: z.coerce.date().optional(), @@ -1213,6 +1395,7 @@ export const GameCreateInputSchema: z.ZodType = z.object allowSpecials: z.boolean().optional(), allowChat: z.boolean().optional(), allowMarkDraw: z.boolean().optional(), + ships: z.lazy(() => ShipCreateNestedManyWithoutGameInputSchema).optional(), gamePin: z.lazy(() => GamepinCreateNestedOneWithoutGameInputSchema).optional(), users: z.lazy(() => User_GameCreateNestedManyWithoutGameInputSchema).optional() }).strict(); @@ -1226,6 +1409,7 @@ export const GameUncheckedCreateInputSchema: z.ZodType ShipUncheckedCreateNestedManyWithoutGameInputSchema).optional(), gamePin: z.lazy(() => GamepinUncheckedCreateNestedOneWithoutGameInputSchema).optional(), users: z.lazy(() => User_GameUncheckedCreateNestedManyWithoutGameInputSchema).optional() }).strict(); @@ -1239,6 +1423,7 @@ export const GameUpdateInputSchema: z.ZodType = z.object allowSpecials: z.union([ z.boolean(),z.lazy(() => BoolFieldUpdateOperationsInputSchema) ]).optional(), allowChat: z.union([ z.boolean(),z.lazy(() => BoolFieldUpdateOperationsInputSchema) ]).optional(), allowMarkDraw: z.union([ z.boolean(),z.lazy(() => BoolFieldUpdateOperationsInputSchema) ]).optional(), + ships: z.lazy(() => ShipUpdateManyWithoutGameNestedInputSchema).optional(), gamePin: z.lazy(() => GamepinUpdateOneWithoutGameNestedInputSchema).optional(), users: z.lazy(() => User_GameUpdateManyWithoutGameNestedInputSchema).optional() }).strict(); @@ -1252,6 +1437,7 @@ export const GameUncheckedUpdateInputSchema: z.ZodType BoolFieldUpdateOperationsInputSchema) ]).optional(), allowChat: z.union([ z.boolean(),z.lazy(() => BoolFieldUpdateOperationsInputSchema) ]).optional(), allowMarkDraw: z.union([ z.boolean(),z.lazy(() => BoolFieldUpdateOperationsInputSchema) ]).optional(), + ships: z.lazy(() => ShipUncheckedUpdateManyWithoutGameNestedInputSchema).optional(), gamePin: z.lazy(() => GamepinUncheckedUpdateOneWithoutGameNestedInputSchema).optional(), users: z.lazy(() => User_GameUncheckedUpdateManyWithoutGameNestedInputSchema).optional() }).strict(); @@ -1403,6 +1589,9 @@ export const MoveCreateInputSchema: z.ZodType = z.object id: z.string().cuid().optional(), createdAt: z.coerce.date().optional(), index: z.number().int(), + action: z.lazy(() => MoveTypeSchema), + x: z.number().int(), + y: z.number().int(), user_game: z.lazy(() => User_GameCreateNestedOneWithoutMovesInputSchema) }).strict(); @@ -1410,6 +1599,9 @@ export const MoveUncheckedCreateInputSchema: z.ZodType MoveTypeSchema), + x: z.number().int(), + y: z.number().int(), user_game_id: z.string() }).strict(); @@ -1417,6 +1609,9 @@ export const MoveUpdateInputSchema: z.ZodType = z.object id: z.union([ z.string().cuid(),z.lazy(() => StringFieldUpdateOperationsInputSchema) ]).optional(), createdAt: z.union([ z.coerce.date(),z.lazy(() => DateTimeFieldUpdateOperationsInputSchema) ]).optional(), index: z.union([ z.number().int(),z.lazy(() => IntFieldUpdateOperationsInputSchema) ]).optional(), + action: z.union([ z.lazy(() => MoveTypeSchema),z.lazy(() => EnumMoveTypeFieldUpdateOperationsInputSchema) ]).optional(), + x: z.union([ z.number().int(),z.lazy(() => IntFieldUpdateOperationsInputSchema) ]).optional(), + y: z.union([ z.number().int(),z.lazy(() => IntFieldUpdateOperationsInputSchema) ]).optional(), user_game: z.lazy(() => User_GameUpdateOneRequiredWithoutMovesNestedInputSchema).optional() }).strict(); @@ -1424,6 +1619,9 @@ export const MoveUncheckedUpdateInputSchema: z.ZodType StringFieldUpdateOperationsInputSchema) ]).optional(), createdAt: z.union([ z.coerce.date(),z.lazy(() => DateTimeFieldUpdateOperationsInputSchema) ]).optional(), index: z.union([ z.number().int(),z.lazy(() => IntFieldUpdateOperationsInputSchema) ]).optional(), + action: z.union([ z.lazy(() => MoveTypeSchema),z.lazy(() => EnumMoveTypeFieldUpdateOperationsInputSchema) ]).optional(), + x: z.union([ z.number().int(),z.lazy(() => IntFieldUpdateOperationsInputSchema) ]).optional(), + y: z.union([ z.number().int(),z.lazy(() => IntFieldUpdateOperationsInputSchema) ]).optional(), user_game_id: z.union([ z.string(),z.lazy(() => StringFieldUpdateOperationsInputSchema) ]).optional(), }).strict(); @@ -1431,6 +1629,9 @@ export const MoveCreateManyInputSchema: z.ZodType = id: z.string().cuid().optional(), createdAt: z.coerce.date().optional(), index: z.number().int(), + action: z.lazy(() => MoveTypeSchema), + x: z.number().int(), + y: z.number().int(), user_game_id: z.string() }).strict(); @@ -1438,12 +1639,18 @@ export const MoveUpdateManyMutationInputSchema: z.ZodType StringFieldUpdateOperationsInputSchema) ]).optional(), createdAt: z.union([ z.coerce.date(),z.lazy(() => DateTimeFieldUpdateOperationsInputSchema) ]).optional(), index: z.union([ z.number().int(),z.lazy(() => IntFieldUpdateOperationsInputSchema) ]).optional(), + action: z.union([ z.lazy(() => MoveTypeSchema),z.lazy(() => EnumMoveTypeFieldUpdateOperationsInputSchema) ]).optional(), + x: z.union([ z.number().int(),z.lazy(() => IntFieldUpdateOperationsInputSchema) ]).optional(), + y: z.union([ z.number().int(),z.lazy(() => IntFieldUpdateOperationsInputSchema) ]).optional(), }).strict(); export const MoveUncheckedUpdateManyInputSchema: z.ZodType = z.object({ id: z.union([ z.string().cuid(),z.lazy(() => StringFieldUpdateOperationsInputSchema) ]).optional(), createdAt: z.union([ z.coerce.date(),z.lazy(() => DateTimeFieldUpdateOperationsInputSchema) ]).optional(), index: z.union([ z.number().int(),z.lazy(() => IntFieldUpdateOperationsInputSchema) ]).optional(), + action: z.union([ z.lazy(() => MoveTypeSchema),z.lazy(() => EnumMoveTypeFieldUpdateOperationsInputSchema) ]).optional(), + x: z.union([ z.number().int(),z.lazy(() => IntFieldUpdateOperationsInputSchema) ]).optional(), + y: z.union([ z.number().int(),z.lazy(() => IntFieldUpdateOperationsInputSchema) ]).optional(), user_game_id: z.union([ z.string(),z.lazy(() => StringFieldUpdateOperationsInputSchema) ]).optional(), }).strict(); @@ -1819,6 +2026,79 @@ export const VerificationTokenMinOrderByAggregateInputSchema: z.ZodType SortOrderSchema).optional() }).strict(); +export const IntFilterSchema: z.ZodType = z.object({ + equals: z.number().optional(), + in: z.union([ z.number().array(),z.number() ]).optional(), + notIn: z.union([ z.number().array(),z.number() ]).optional(), + lt: z.number().optional(), + lte: z.number().optional(), + gt: z.number().optional(), + gte: z.number().optional(), + not: z.union([ z.number(),z.lazy(() => NestedIntFilterSchema) ]).optional(), +}).strict(); + +export const GameRelationFilterSchema: z.ZodType = z.object({ + is: z.lazy(() => GameWhereInputSchema).optional(), + isNot: z.lazy(() => GameWhereInputSchema).optional() +}).strict(); + +export const ShipCountOrderByAggregateInputSchema: z.ZodType = z.object({ + id: z.lazy(() => SortOrderSchema).optional(), + size: z.lazy(() => SortOrderSchema).optional(), + variant: z.lazy(() => SortOrderSchema).optional(), + x: z.lazy(() => SortOrderSchema).optional(), + y: z.lazy(() => SortOrderSchema).optional(), + gameId: z.lazy(() => SortOrderSchema).optional() +}).strict(); + +export const ShipAvgOrderByAggregateInputSchema: z.ZodType = z.object({ + size: z.lazy(() => SortOrderSchema).optional(), + variant: z.lazy(() => SortOrderSchema).optional(), + x: z.lazy(() => SortOrderSchema).optional(), + y: z.lazy(() => SortOrderSchema).optional() +}).strict(); + +export const ShipMaxOrderByAggregateInputSchema: z.ZodType = z.object({ + id: z.lazy(() => SortOrderSchema).optional(), + size: z.lazy(() => SortOrderSchema).optional(), + variant: z.lazy(() => SortOrderSchema).optional(), + x: z.lazy(() => SortOrderSchema).optional(), + y: z.lazy(() => SortOrderSchema).optional(), + gameId: z.lazy(() => SortOrderSchema).optional() +}).strict(); + +export const ShipMinOrderByAggregateInputSchema: z.ZodType = z.object({ + id: z.lazy(() => SortOrderSchema).optional(), + size: z.lazy(() => SortOrderSchema).optional(), + variant: z.lazy(() => SortOrderSchema).optional(), + x: z.lazy(() => SortOrderSchema).optional(), + y: z.lazy(() => SortOrderSchema).optional(), + gameId: z.lazy(() => SortOrderSchema).optional() +}).strict(); + +export const ShipSumOrderByAggregateInputSchema: z.ZodType = z.object({ + size: z.lazy(() => SortOrderSchema).optional(), + variant: z.lazy(() => SortOrderSchema).optional(), + x: z.lazy(() => SortOrderSchema).optional(), + y: z.lazy(() => SortOrderSchema).optional() +}).strict(); + +export const IntWithAggregatesFilterSchema: z.ZodType = z.object({ + equals: z.number().optional(), + in: z.union([ z.number().array(),z.number() ]).optional(), + notIn: z.union([ z.number().array(),z.number() ]).optional(), + lt: z.number().optional(), + lte: z.number().optional(), + gt: z.number().optional(), + gte: z.number().optional(), + not: z.union([ z.number(),z.lazy(() => NestedIntWithAggregatesFilterSchema) ]).optional(), + _count: z.lazy(() => NestedIntFilterSchema).optional(), + _avg: z.lazy(() => NestedFloatFilterSchema).optional(), + _sum: z.lazy(() => NestedIntFilterSchema).optional(), + _min: z.lazy(() => NestedIntFilterSchema).optional(), + _max: z.lazy(() => NestedIntFilterSchema).optional() +}).strict(); + export const EnumGameStateFilterSchema: z.ZodType = z.object({ equals: z.lazy(() => GameStateSchema).optional(), in: z.union([ z.lazy(() => GameStateSchema).array(),z.lazy(() => GameStateSchema) ]).optional(), @@ -1831,11 +2111,21 @@ export const BoolFilterSchema: z.ZodType = z.object({ not: z.union([ z.boolean(),z.lazy(() => NestedBoolFilterSchema) ]).optional(), }).strict(); +export const ShipListRelationFilterSchema: z.ZodType = z.object({ + every: z.lazy(() => ShipWhereInputSchema).optional(), + some: z.lazy(() => ShipWhereInputSchema).optional(), + none: z.lazy(() => ShipWhereInputSchema).optional() +}).strict(); + export const GamepinRelationFilterSchema: z.ZodType = z.object({ is: z.lazy(() => GamepinWhereInputSchema).optional().nullable(), isNot: z.lazy(() => GamepinWhereInputSchema).optional().nullable() }).strict(); +export const ShipOrderByRelationAggregateInputSchema: z.ZodType = z.object({ + _count: z.lazy(() => SortOrderSchema).optional() +}).strict(); + export const GameCountOrderByAggregateInputSchema: z.ZodType = z.object({ id: z.lazy(() => SortOrderSchema).optional(), createdAt: z.lazy(() => SortOrderSchema).optional(), @@ -1887,11 +2177,6 @@ export const BoolWithAggregatesFilterSchema: z.ZodType NestedBoolFilterSchema).optional() }).strict(); -export const GameRelationFilterSchema: z.ZodType = z.object({ - is: z.lazy(() => GameWhereInputSchema).optional(), - isNot: z.lazy(() => GameWhereInputSchema).optional() -}).strict(); - export const GamepinCountOrderByAggregateInputSchema: z.ZodType = z.object({ id: z.lazy(() => SortOrderSchema).optional(), createdAt: z.lazy(() => SortOrderSchema).optional(), @@ -1913,17 +2198,6 @@ export const GamepinMinOrderByAggregateInputSchema: z.ZodType SortOrderSchema).optional() }).strict(); -export const IntFilterSchema: z.ZodType = z.object({ - equals: z.number().optional(), - in: z.union([ z.number().array(),z.number() ]).optional(), - notIn: z.union([ z.number().array(),z.number() ]).optional(), - lt: z.number().optional(), - lte: z.number().optional(), - gt: z.number().optional(), - gte: z.number().optional(), - not: z.union([ z.number(),z.lazy(() => NestedIntFilterSchema) ]).optional(), -}).strict(); - export const MoveListRelationFilterSchema: z.ZodType = z.object({ every: z.lazy(() => MoveWhereInputSchema).optional(), some: z.lazy(() => MoveWhereInputSchema).optional(), @@ -1986,20 +2260,11 @@ export const User_GameSumOrderByAggregateInputSchema: z.ZodType SortOrderSchema).optional() }).strict(); -export const IntWithAggregatesFilterSchema: z.ZodType = z.object({ - equals: z.number().optional(), - in: z.union([ z.number().array(),z.number() ]).optional(), - notIn: z.union([ z.number().array(),z.number() ]).optional(), - lt: z.number().optional(), - lte: z.number().optional(), - gt: z.number().optional(), - gte: z.number().optional(), - not: z.union([ z.number(),z.lazy(() => NestedIntWithAggregatesFilterSchema) ]).optional(), - _count: z.lazy(() => NestedIntFilterSchema).optional(), - _avg: z.lazy(() => NestedFloatFilterSchema).optional(), - _sum: z.lazy(() => NestedIntFilterSchema).optional(), - _min: z.lazy(() => NestedIntFilterSchema).optional(), - _max: z.lazy(() => NestedIntFilterSchema).optional() +export const EnumMoveTypeFilterSchema: z.ZodType = z.object({ + equals: z.lazy(() => MoveTypeSchema).optional(), + in: z.union([ z.lazy(() => MoveTypeSchema).array(),z.lazy(() => MoveTypeSchema) ]).optional(), + notIn: z.union([ z.lazy(() => MoveTypeSchema).array(),z.lazy(() => MoveTypeSchema) ]).optional(), + not: z.union([ z.lazy(() => MoveTypeSchema),z.lazy(() => NestedEnumMoveTypeFilterSchema) ]).optional(), }).strict(); export const User_GameRelationFilterSchema: z.ZodType = z.object({ @@ -2012,21 +2277,35 @@ export const MoveUser_game_idIndexCompoundUniqueInputSchema: z.ZodType = z.object({ + action: z.lazy(() => MoveTypeSchema), + x: z.number(), + y: z.number() +}).strict(); + export const MoveCountOrderByAggregateInputSchema: z.ZodType = z.object({ id: z.lazy(() => SortOrderSchema).optional(), createdAt: z.lazy(() => SortOrderSchema).optional(), index: z.lazy(() => SortOrderSchema).optional(), + action: z.lazy(() => SortOrderSchema).optional(), + x: z.lazy(() => SortOrderSchema).optional(), + y: z.lazy(() => SortOrderSchema).optional(), user_game_id: z.lazy(() => SortOrderSchema).optional() }).strict(); export const MoveAvgOrderByAggregateInputSchema: z.ZodType = z.object({ - index: z.lazy(() => SortOrderSchema).optional() + index: z.lazy(() => SortOrderSchema).optional(), + x: z.lazy(() => SortOrderSchema).optional(), + y: z.lazy(() => SortOrderSchema).optional() }).strict(); export const MoveMaxOrderByAggregateInputSchema: z.ZodType = z.object({ id: z.lazy(() => SortOrderSchema).optional(), createdAt: z.lazy(() => SortOrderSchema).optional(), index: z.lazy(() => SortOrderSchema).optional(), + action: z.lazy(() => SortOrderSchema).optional(), + x: z.lazy(() => SortOrderSchema).optional(), + y: z.lazy(() => SortOrderSchema).optional(), user_game_id: z.lazy(() => SortOrderSchema).optional() }).strict(); @@ -2034,11 +2313,26 @@ export const MoveMinOrderByAggregateInputSchema: z.ZodType SortOrderSchema).optional(), createdAt: z.lazy(() => SortOrderSchema).optional(), index: z.lazy(() => SortOrderSchema).optional(), + action: z.lazy(() => SortOrderSchema).optional(), + x: z.lazy(() => SortOrderSchema).optional(), + y: z.lazy(() => SortOrderSchema).optional(), user_game_id: z.lazy(() => SortOrderSchema).optional() }).strict(); export const MoveSumOrderByAggregateInputSchema: z.ZodType = z.object({ - index: z.lazy(() => SortOrderSchema).optional() + index: z.lazy(() => SortOrderSchema).optional(), + x: z.lazy(() => SortOrderSchema).optional(), + y: z.lazy(() => SortOrderSchema).optional() +}).strict(); + +export const EnumMoveTypeWithAggregatesFilterSchema: z.ZodType = z.object({ + equals: z.lazy(() => MoveTypeSchema).optional(), + in: z.union([ z.lazy(() => MoveTypeSchema).array(),z.lazy(() => MoveTypeSchema) ]).optional(), + notIn: z.union([ z.lazy(() => MoveTypeSchema).array(),z.lazy(() => MoveTypeSchema) ]).optional(), + not: z.union([ z.lazy(() => MoveTypeSchema),z.lazy(() => NestedEnumMoveTypeWithAggregatesFilterSchema) ]).optional(), + _count: z.lazy(() => NestedIntFilterSchema).optional(), + _min: z.lazy(() => NestedEnumMoveTypeFilterSchema).optional(), + _max: z.lazy(() => NestedEnumMoveTypeFilterSchema).optional() }).strict(); export const ChatCountOrderByAggregateInputSchema: z.ZodType = z.object({ @@ -2243,6 +2537,35 @@ export const SessionUncheckedUpdateManyWithoutUserNestedInputSchema: z.ZodType

SessionScalarWhereInputSchema),z.lazy(() => SessionScalarWhereInputSchema).array() ]).optional(), }).strict(); +export const GameCreateNestedOneWithoutShipsInputSchema: z.ZodType = z.object({ + create: z.union([ z.lazy(() => GameCreateWithoutShipsInputSchema),z.lazy(() => GameUncheckedCreateWithoutShipsInputSchema) ]).optional(), + connectOrCreate: z.lazy(() => GameCreateOrConnectWithoutShipsInputSchema).optional(), + connect: z.lazy(() => GameWhereUniqueInputSchema).optional() +}).strict(); + +export const IntFieldUpdateOperationsInputSchema: z.ZodType = z.object({ + set: z.number().optional(), + increment: z.number().optional(), + decrement: z.number().optional(), + multiply: z.number().optional(), + divide: z.number().optional() +}).strict(); + +export const GameUpdateOneRequiredWithoutShipsNestedInputSchema: z.ZodType = z.object({ + create: z.union([ z.lazy(() => GameCreateWithoutShipsInputSchema),z.lazy(() => GameUncheckedCreateWithoutShipsInputSchema) ]).optional(), + connectOrCreate: z.lazy(() => GameCreateOrConnectWithoutShipsInputSchema).optional(), + upsert: z.lazy(() => GameUpsertWithoutShipsInputSchema).optional(), + connect: z.lazy(() => GameWhereUniqueInputSchema).optional(), + update: z.union([ z.lazy(() => GameUpdateWithoutShipsInputSchema),z.lazy(() => GameUncheckedUpdateWithoutShipsInputSchema) ]).optional(), +}).strict(); + +export const ShipCreateNestedManyWithoutGameInputSchema: z.ZodType = z.object({ + create: z.union([ z.lazy(() => ShipCreateWithoutGameInputSchema),z.lazy(() => ShipCreateWithoutGameInputSchema).array(),z.lazy(() => ShipUncheckedCreateWithoutGameInputSchema),z.lazy(() => ShipUncheckedCreateWithoutGameInputSchema).array() ]).optional(), + connectOrCreate: z.union([ z.lazy(() => ShipCreateOrConnectWithoutGameInputSchema),z.lazy(() => ShipCreateOrConnectWithoutGameInputSchema).array() ]).optional(), + createMany: z.lazy(() => ShipCreateManyGameInputEnvelopeSchema).optional(), + connect: z.union([ z.lazy(() => ShipWhereUniqueInputSchema),z.lazy(() => ShipWhereUniqueInputSchema).array() ]).optional(), +}).strict(); + export const GamepinCreateNestedOneWithoutGameInputSchema: z.ZodType = z.object({ create: z.union([ z.lazy(() => GamepinCreateWithoutGameInputSchema),z.lazy(() => GamepinUncheckedCreateWithoutGameInputSchema) ]).optional(), connectOrCreate: z.lazy(() => GamepinCreateOrConnectWithoutGameInputSchema).optional(), @@ -2256,6 +2579,13 @@ export const User_GameCreateNestedManyWithoutGameInputSchema: z.ZodType User_GameWhereUniqueInputSchema),z.lazy(() => User_GameWhereUniqueInputSchema).array() ]).optional(), }).strict(); +export const ShipUncheckedCreateNestedManyWithoutGameInputSchema: z.ZodType = z.object({ + create: z.union([ z.lazy(() => ShipCreateWithoutGameInputSchema),z.lazy(() => ShipCreateWithoutGameInputSchema).array(),z.lazy(() => ShipUncheckedCreateWithoutGameInputSchema),z.lazy(() => ShipUncheckedCreateWithoutGameInputSchema).array() ]).optional(), + connectOrCreate: z.union([ z.lazy(() => ShipCreateOrConnectWithoutGameInputSchema),z.lazy(() => ShipCreateOrConnectWithoutGameInputSchema).array() ]).optional(), + createMany: z.lazy(() => ShipCreateManyGameInputEnvelopeSchema).optional(), + connect: z.union([ z.lazy(() => ShipWhereUniqueInputSchema),z.lazy(() => ShipWhereUniqueInputSchema).array() ]).optional(), +}).strict(); + export const GamepinUncheckedCreateNestedOneWithoutGameInputSchema: z.ZodType = z.object({ create: z.union([ z.lazy(() => GamepinCreateWithoutGameInputSchema),z.lazy(() => GamepinUncheckedCreateWithoutGameInputSchema) ]).optional(), connectOrCreate: z.lazy(() => GamepinCreateOrConnectWithoutGameInputSchema).optional(), @@ -2277,6 +2607,20 @@ export const BoolFieldUpdateOperationsInputSchema: z.ZodType = z.object({ + create: z.union([ z.lazy(() => ShipCreateWithoutGameInputSchema),z.lazy(() => ShipCreateWithoutGameInputSchema).array(),z.lazy(() => ShipUncheckedCreateWithoutGameInputSchema),z.lazy(() => ShipUncheckedCreateWithoutGameInputSchema).array() ]).optional(), + connectOrCreate: z.union([ z.lazy(() => ShipCreateOrConnectWithoutGameInputSchema),z.lazy(() => ShipCreateOrConnectWithoutGameInputSchema).array() ]).optional(), + upsert: z.union([ z.lazy(() => ShipUpsertWithWhereUniqueWithoutGameInputSchema),z.lazy(() => ShipUpsertWithWhereUniqueWithoutGameInputSchema).array() ]).optional(), + createMany: z.lazy(() => ShipCreateManyGameInputEnvelopeSchema).optional(), + set: z.union([ z.lazy(() => ShipWhereUniqueInputSchema),z.lazy(() => ShipWhereUniqueInputSchema).array() ]).optional(), + disconnect: z.union([ z.lazy(() => ShipWhereUniqueInputSchema),z.lazy(() => ShipWhereUniqueInputSchema).array() ]).optional(), + delete: z.union([ z.lazy(() => ShipWhereUniqueInputSchema),z.lazy(() => ShipWhereUniqueInputSchema).array() ]).optional(), + connect: z.union([ z.lazy(() => ShipWhereUniqueInputSchema),z.lazy(() => ShipWhereUniqueInputSchema).array() ]).optional(), + update: z.union([ z.lazy(() => ShipUpdateWithWhereUniqueWithoutGameInputSchema),z.lazy(() => ShipUpdateWithWhereUniqueWithoutGameInputSchema).array() ]).optional(), + updateMany: z.union([ z.lazy(() => ShipUpdateManyWithWhereWithoutGameInputSchema),z.lazy(() => ShipUpdateManyWithWhereWithoutGameInputSchema).array() ]).optional(), + deleteMany: z.union([ z.lazy(() => ShipScalarWhereInputSchema),z.lazy(() => ShipScalarWhereInputSchema).array() ]).optional(), +}).strict(); + export const GamepinUpdateOneWithoutGameNestedInputSchema: z.ZodType = z.object({ create: z.union([ z.lazy(() => GamepinCreateWithoutGameInputSchema),z.lazy(() => GamepinUncheckedCreateWithoutGameInputSchema) ]).optional(), connectOrCreate: z.lazy(() => GamepinCreateOrConnectWithoutGameInputSchema).optional(), @@ -2301,6 +2645,20 @@ export const User_GameUpdateManyWithoutGameNestedInputSchema: z.ZodType User_GameScalarWhereInputSchema),z.lazy(() => User_GameScalarWhereInputSchema).array() ]).optional(), }).strict(); +export const ShipUncheckedUpdateManyWithoutGameNestedInputSchema: z.ZodType = z.object({ + create: z.union([ z.lazy(() => ShipCreateWithoutGameInputSchema),z.lazy(() => ShipCreateWithoutGameInputSchema).array(),z.lazy(() => ShipUncheckedCreateWithoutGameInputSchema),z.lazy(() => ShipUncheckedCreateWithoutGameInputSchema).array() ]).optional(), + connectOrCreate: z.union([ z.lazy(() => ShipCreateOrConnectWithoutGameInputSchema),z.lazy(() => ShipCreateOrConnectWithoutGameInputSchema).array() ]).optional(), + upsert: z.union([ z.lazy(() => ShipUpsertWithWhereUniqueWithoutGameInputSchema),z.lazy(() => ShipUpsertWithWhereUniqueWithoutGameInputSchema).array() ]).optional(), + createMany: z.lazy(() => ShipCreateManyGameInputEnvelopeSchema).optional(), + set: z.union([ z.lazy(() => ShipWhereUniqueInputSchema),z.lazy(() => ShipWhereUniqueInputSchema).array() ]).optional(), + disconnect: z.union([ z.lazy(() => ShipWhereUniqueInputSchema),z.lazy(() => ShipWhereUniqueInputSchema).array() ]).optional(), + delete: z.union([ z.lazy(() => ShipWhereUniqueInputSchema),z.lazy(() => ShipWhereUniqueInputSchema).array() ]).optional(), + connect: z.union([ z.lazy(() => ShipWhereUniqueInputSchema),z.lazy(() => ShipWhereUniqueInputSchema).array() ]).optional(), + update: z.union([ z.lazy(() => ShipUpdateWithWhereUniqueWithoutGameInputSchema),z.lazy(() => ShipUpdateWithWhereUniqueWithoutGameInputSchema).array() ]).optional(), + updateMany: z.union([ z.lazy(() => ShipUpdateManyWithWhereWithoutGameInputSchema),z.lazy(() => ShipUpdateManyWithWhereWithoutGameInputSchema).array() ]).optional(), + deleteMany: z.union([ z.lazy(() => ShipScalarWhereInputSchema),z.lazy(() => ShipScalarWhereInputSchema).array() ]).optional(), +}).strict(); + export const GamepinUncheckedUpdateOneWithoutGameNestedInputSchema: z.ZodType = z.object({ create: z.union([ z.lazy(() => GamepinCreateWithoutGameInputSchema),z.lazy(() => GamepinUncheckedCreateWithoutGameInputSchema) ]).optional(), connectOrCreate: z.lazy(() => GamepinCreateOrConnectWithoutGameInputSchema).optional(), @@ -2379,14 +2737,6 @@ export const ChatUncheckedCreateNestedManyWithoutUser_gameInputSchema: z.ZodType connect: z.union([ z.lazy(() => ChatWhereUniqueInputSchema),z.lazy(() => ChatWhereUniqueInputSchema).array() ]).optional(), }).strict(); -export const IntFieldUpdateOperationsInputSchema: z.ZodType = z.object({ - set: z.number().optional(), - increment: z.number().optional(), - decrement: z.number().optional(), - multiply: z.number().optional(), - divide: z.number().optional() -}).strict(); - export const MoveUpdateManyWithoutUser_gameNestedInputSchema: z.ZodType = z.object({ create: z.union([ z.lazy(() => MoveCreateWithoutUser_gameInputSchema),z.lazy(() => MoveCreateWithoutUser_gameInputSchema).array(),z.lazy(() => MoveUncheckedCreateWithoutUser_gameInputSchema),z.lazy(() => MoveUncheckedCreateWithoutUser_gameInputSchema).array() ]).optional(), connectOrCreate: z.union([ z.lazy(() => MoveCreateOrConnectWithoutUser_gameInputSchema),z.lazy(() => MoveCreateOrConnectWithoutUser_gameInputSchema).array() ]).optional(), @@ -2465,6 +2815,10 @@ export const User_GameCreateNestedOneWithoutMovesInputSchema: z.ZodType User_GameWhereUniqueInputSchema).optional() }).strict(); +export const EnumMoveTypeFieldUpdateOperationsInputSchema: z.ZodType = z.object({ + set: z.lazy(() => MoveTypeSchema).optional() +}).strict(); + export const User_GameUpdateOneRequiredWithoutMovesNestedInputSchema: z.ZodType = z.object({ create: z.union([ z.lazy(() => User_GameCreateWithoutMovesInputSchema),z.lazy(() => User_GameUncheckedCreateWithoutMovesInputSchema) ]).optional(), connectOrCreate: z.lazy(() => User_GameCreateOrConnectWithoutMovesInputSchema).optional(), @@ -2648,6 +3002,33 @@ export const NestedDateTimeNullableWithAggregatesFilterSchema: z.ZodType NestedDateTimeNullableFilterSchema).optional() }).strict(); +export const NestedIntWithAggregatesFilterSchema: z.ZodType = z.object({ + equals: z.number().optional(), + in: z.union([ z.number().array(),z.number() ]).optional(), + notIn: z.union([ z.number().array(),z.number() ]).optional(), + lt: z.number().optional(), + lte: z.number().optional(), + gt: z.number().optional(), + gte: z.number().optional(), + not: z.union([ z.number(),z.lazy(() => NestedIntWithAggregatesFilterSchema) ]).optional(), + _count: z.lazy(() => NestedIntFilterSchema).optional(), + _avg: z.lazy(() => NestedFloatFilterSchema).optional(), + _sum: z.lazy(() => NestedIntFilterSchema).optional(), + _min: z.lazy(() => NestedIntFilterSchema).optional(), + _max: z.lazy(() => NestedIntFilterSchema).optional() +}).strict(); + +export const NestedFloatFilterSchema: z.ZodType = z.object({ + equals: z.number().optional(), + in: z.union([ z.number().array(),z.number() ]).optional(), + notIn: z.union([ z.number().array(),z.number() ]).optional(), + lt: z.number().optional(), + lte: z.number().optional(), + gt: z.number().optional(), + gte: z.number().optional(), + not: z.union([ z.number(),z.lazy(() => NestedFloatFilterSchema) ]).optional(), +}).strict(); + export const NestedEnumGameStateFilterSchema: z.ZodType = z.object({ equals: z.lazy(() => GameStateSchema).optional(), in: z.union([ z.lazy(() => GameStateSchema).array(),z.lazy(() => GameStateSchema) ]).optional(), @@ -2678,31 +3059,21 @@ export const NestedBoolWithAggregatesFilterSchema: z.ZodType NestedBoolFilterSchema).optional() }).strict(); -export const NestedIntWithAggregatesFilterSchema: z.ZodType = z.object({ - equals: z.number().optional(), - in: z.union([ z.number().array(),z.number() ]).optional(), - notIn: z.union([ z.number().array(),z.number() ]).optional(), - lt: z.number().optional(), - lte: z.number().optional(), - gt: z.number().optional(), - gte: z.number().optional(), - not: z.union([ z.number(),z.lazy(() => NestedIntWithAggregatesFilterSchema) ]).optional(), - _count: z.lazy(() => NestedIntFilterSchema).optional(), - _avg: z.lazy(() => NestedFloatFilterSchema).optional(), - _sum: z.lazy(() => NestedIntFilterSchema).optional(), - _min: z.lazy(() => NestedIntFilterSchema).optional(), - _max: z.lazy(() => NestedIntFilterSchema).optional() +export const NestedEnumMoveTypeFilterSchema: z.ZodType = z.object({ + equals: z.lazy(() => MoveTypeSchema).optional(), + in: z.union([ z.lazy(() => MoveTypeSchema).array(),z.lazy(() => MoveTypeSchema) ]).optional(), + notIn: z.union([ z.lazy(() => MoveTypeSchema).array(),z.lazy(() => MoveTypeSchema) ]).optional(), + not: z.union([ z.lazy(() => MoveTypeSchema),z.lazy(() => NestedEnumMoveTypeFilterSchema) ]).optional(), }).strict(); -export const NestedFloatFilterSchema: z.ZodType = z.object({ - equals: z.number().optional(), - in: z.union([ z.number().array(),z.number() ]).optional(), - notIn: z.union([ z.number().array(),z.number() ]).optional(), - lt: z.number().optional(), - lte: z.number().optional(), - gt: z.number().optional(), - gte: z.number().optional(), - not: z.union([ z.number(),z.lazy(() => NestedFloatFilterSchema) ]).optional(), +export const NestedEnumMoveTypeWithAggregatesFilterSchema: z.ZodType = z.object({ + equals: z.lazy(() => MoveTypeSchema).optional(), + in: z.union([ z.lazy(() => MoveTypeSchema).array(),z.lazy(() => MoveTypeSchema) ]).optional(), + notIn: z.union([ z.lazy(() => MoveTypeSchema).array(),z.lazy(() => MoveTypeSchema) ]).optional(), + not: z.union([ z.lazy(() => MoveTypeSchema),z.lazy(() => NestedEnumMoveTypeWithAggregatesFilterSchema) ]).optional(), + _count: z.lazy(() => NestedIntFilterSchema).optional(), + _min: z.lazy(() => NestedEnumMoveTypeFilterSchema).optional(), + _max: z.lazy(() => NestedEnumMoveTypeFilterSchema).optional() }).strict(); export const UserCreateWithoutAccountsInputSchema: z.ZodType = z.object({ @@ -3005,6 +3376,94 @@ export const SessionScalarWhereInputSchema: z.ZodType DateTimeFilterSchema),z.coerce.date() ]).optional(), }).strict(); +export const GameCreateWithoutShipsInputSchema: z.ZodType = z.object({ + id: z.string().cuid().optional(), + createdAt: z.coerce.date().optional(), + updatedAt: z.coerce.date().optional(), + state: z.lazy(() => GameStateSchema).optional(), + allowSpectators: z.boolean().optional(), + allowSpecials: z.boolean().optional(), + allowChat: z.boolean().optional(), + allowMarkDraw: z.boolean().optional(), + gamePin: z.lazy(() => GamepinCreateNestedOneWithoutGameInputSchema).optional(), + users: z.lazy(() => User_GameCreateNestedManyWithoutGameInputSchema).optional() +}).strict(); + +export const GameUncheckedCreateWithoutShipsInputSchema: z.ZodType = z.object({ + id: z.string().cuid().optional(), + createdAt: z.coerce.date().optional(), + updatedAt: z.coerce.date().optional(), + state: z.lazy(() => GameStateSchema).optional(), + allowSpectators: z.boolean().optional(), + allowSpecials: z.boolean().optional(), + allowChat: z.boolean().optional(), + allowMarkDraw: z.boolean().optional(), + gamePin: z.lazy(() => GamepinUncheckedCreateNestedOneWithoutGameInputSchema).optional(), + users: z.lazy(() => User_GameUncheckedCreateNestedManyWithoutGameInputSchema).optional() +}).strict(); + +export const GameCreateOrConnectWithoutShipsInputSchema: z.ZodType = z.object({ + where: z.lazy(() => GameWhereUniqueInputSchema), + create: z.union([ z.lazy(() => GameCreateWithoutShipsInputSchema),z.lazy(() => GameUncheckedCreateWithoutShipsInputSchema) ]), +}).strict(); + +export const GameUpsertWithoutShipsInputSchema: z.ZodType = z.object({ + update: z.union([ z.lazy(() => GameUpdateWithoutShipsInputSchema),z.lazy(() => GameUncheckedUpdateWithoutShipsInputSchema) ]), + create: z.union([ z.lazy(() => GameCreateWithoutShipsInputSchema),z.lazy(() => GameUncheckedCreateWithoutShipsInputSchema) ]), +}).strict(); + +export const GameUpdateWithoutShipsInputSchema: z.ZodType = z.object({ + id: z.union([ z.string().cuid(),z.lazy(() => StringFieldUpdateOperationsInputSchema) ]).optional(), + createdAt: z.union([ z.coerce.date(),z.lazy(() => DateTimeFieldUpdateOperationsInputSchema) ]).optional(), + updatedAt: z.union([ z.coerce.date(),z.lazy(() => DateTimeFieldUpdateOperationsInputSchema) ]).optional(), + state: z.union([ z.lazy(() => GameStateSchema),z.lazy(() => EnumGameStateFieldUpdateOperationsInputSchema) ]).optional(), + allowSpectators: z.union([ z.boolean(),z.lazy(() => BoolFieldUpdateOperationsInputSchema) ]).optional(), + allowSpecials: z.union([ z.boolean(),z.lazy(() => BoolFieldUpdateOperationsInputSchema) ]).optional(), + allowChat: z.union([ z.boolean(),z.lazy(() => BoolFieldUpdateOperationsInputSchema) ]).optional(), + allowMarkDraw: z.union([ z.boolean(),z.lazy(() => BoolFieldUpdateOperationsInputSchema) ]).optional(), + gamePin: z.lazy(() => GamepinUpdateOneWithoutGameNestedInputSchema).optional(), + users: z.lazy(() => User_GameUpdateManyWithoutGameNestedInputSchema).optional() +}).strict(); + +export const GameUncheckedUpdateWithoutShipsInputSchema: z.ZodType = z.object({ + id: z.union([ z.string().cuid(),z.lazy(() => StringFieldUpdateOperationsInputSchema) ]).optional(), + createdAt: z.union([ z.coerce.date(),z.lazy(() => DateTimeFieldUpdateOperationsInputSchema) ]).optional(), + updatedAt: z.union([ z.coerce.date(),z.lazy(() => DateTimeFieldUpdateOperationsInputSchema) ]).optional(), + state: z.union([ z.lazy(() => GameStateSchema),z.lazy(() => EnumGameStateFieldUpdateOperationsInputSchema) ]).optional(), + allowSpectators: z.union([ z.boolean(),z.lazy(() => BoolFieldUpdateOperationsInputSchema) ]).optional(), + allowSpecials: z.union([ z.boolean(),z.lazy(() => BoolFieldUpdateOperationsInputSchema) ]).optional(), + allowChat: z.union([ z.boolean(),z.lazy(() => BoolFieldUpdateOperationsInputSchema) ]).optional(), + allowMarkDraw: z.union([ z.boolean(),z.lazy(() => BoolFieldUpdateOperationsInputSchema) ]).optional(), + gamePin: z.lazy(() => GamepinUncheckedUpdateOneWithoutGameNestedInputSchema).optional(), + users: z.lazy(() => User_GameUncheckedUpdateManyWithoutGameNestedInputSchema).optional() +}).strict(); + +export const ShipCreateWithoutGameInputSchema: z.ZodType = z.object({ + id: z.string().cuid().optional(), + size: z.number().int(), + variant: z.number().int(), + x: z.number().int(), + y: z.number().int() +}).strict(); + +export const ShipUncheckedCreateWithoutGameInputSchema: z.ZodType = z.object({ + id: z.string().cuid().optional(), + size: z.number().int(), + variant: z.number().int(), + x: z.number().int(), + y: z.number().int() +}).strict(); + +export const ShipCreateOrConnectWithoutGameInputSchema: z.ZodType = z.object({ + where: z.lazy(() => ShipWhereUniqueInputSchema), + create: z.union([ z.lazy(() => ShipCreateWithoutGameInputSchema),z.lazy(() => ShipUncheckedCreateWithoutGameInputSchema) ]), +}).strict(); + +export const ShipCreateManyGameInputEnvelopeSchema: z.ZodType = z.object({ + data: z.union([ z.lazy(() => ShipCreateManyGameInputSchema),z.lazy(() => ShipCreateManyGameInputSchema).array() ]), + skipDuplicates: z.boolean().optional() +}).strict(); + export const GamepinCreateWithoutGameInputSchema: z.ZodType = z.object({ id: z.string().cuid().optional(), createdAt: z.coerce.date().optional(), @@ -3050,6 +3509,34 @@ export const User_GameCreateManyGameInputEnvelopeSchema: z.ZodType = z.object({ + where: z.lazy(() => ShipWhereUniqueInputSchema), + update: z.union([ z.lazy(() => ShipUpdateWithoutGameInputSchema),z.lazy(() => ShipUncheckedUpdateWithoutGameInputSchema) ]), + create: z.union([ z.lazy(() => ShipCreateWithoutGameInputSchema),z.lazy(() => ShipUncheckedCreateWithoutGameInputSchema) ]), +}).strict(); + +export const ShipUpdateWithWhereUniqueWithoutGameInputSchema: z.ZodType = z.object({ + where: z.lazy(() => ShipWhereUniqueInputSchema), + data: z.union([ z.lazy(() => ShipUpdateWithoutGameInputSchema),z.lazy(() => ShipUncheckedUpdateWithoutGameInputSchema) ]), +}).strict(); + +export const ShipUpdateManyWithWhereWithoutGameInputSchema: z.ZodType = z.object({ + where: z.lazy(() => ShipScalarWhereInputSchema), + data: z.union([ z.lazy(() => ShipUpdateManyMutationInputSchema),z.lazy(() => ShipUncheckedUpdateManyWithoutShipsInputSchema) ]), +}).strict(); + +export const ShipScalarWhereInputSchema: z.ZodType = z.object({ + AND: z.union([ z.lazy(() => ShipScalarWhereInputSchema),z.lazy(() => ShipScalarWhereInputSchema).array() ]).optional(), + OR: z.lazy(() => ShipScalarWhereInputSchema).array().optional(), + NOT: z.union([ z.lazy(() => ShipScalarWhereInputSchema),z.lazy(() => ShipScalarWhereInputSchema).array() ]).optional(), + id: z.union([ z.lazy(() => StringFilterSchema),z.string() ]).optional(), + size: z.union([ z.lazy(() => IntFilterSchema),z.number() ]).optional(), + variant: z.union([ z.lazy(() => IntFilterSchema),z.number() ]).optional(), + x: z.union([ z.lazy(() => IntFilterSchema),z.number() ]).optional(), + y: z.union([ z.lazy(() => IntFilterSchema),z.number() ]).optional(), + gameId: z.union([ z.lazy(() => StringFilterSchema),z.string() ]).optional(), +}).strict(); + export const GamepinUpsertWithoutGameInputSchema: z.ZodType = z.object({ update: z.union([ z.lazy(() => GamepinUpdateWithoutGameInputSchema),z.lazy(() => GamepinUncheckedUpdateWithoutGameInputSchema) ]), create: z.union([ z.lazy(() => GamepinCreateWithoutGameInputSchema),z.lazy(() => GamepinUncheckedCreateWithoutGameInputSchema) ]), @@ -3092,6 +3579,7 @@ export const GameCreateWithoutGamePinInputSchema: z.ZodType ShipCreateNestedManyWithoutGameInputSchema).optional(), users: z.lazy(() => User_GameCreateNestedManyWithoutGameInputSchema).optional() }).strict(); @@ -3104,6 +3592,7 @@ export const GameUncheckedCreateWithoutGamePinInputSchema: z.ZodType ShipUncheckedCreateNestedManyWithoutGameInputSchema).optional(), users: z.lazy(() => User_GameUncheckedCreateNestedManyWithoutGameInputSchema).optional() }).strict(); @@ -3126,6 +3615,7 @@ export const GameUpdateWithoutGamePinInputSchema: z.ZodType BoolFieldUpdateOperationsInputSchema) ]).optional(), allowChat: z.union([ z.boolean(),z.lazy(() => BoolFieldUpdateOperationsInputSchema) ]).optional(), allowMarkDraw: z.union([ z.boolean(),z.lazy(() => BoolFieldUpdateOperationsInputSchema) ]).optional(), + ships: z.lazy(() => ShipUpdateManyWithoutGameNestedInputSchema).optional(), users: z.lazy(() => User_GameUpdateManyWithoutGameNestedInputSchema).optional() }).strict(); @@ -3138,19 +3628,26 @@ export const GameUncheckedUpdateWithoutGamePinInputSchema: z.ZodType BoolFieldUpdateOperationsInputSchema) ]).optional(), allowChat: z.union([ z.boolean(),z.lazy(() => BoolFieldUpdateOperationsInputSchema) ]).optional(), allowMarkDraw: z.union([ z.boolean(),z.lazy(() => BoolFieldUpdateOperationsInputSchema) ]).optional(), + ships: z.lazy(() => ShipUncheckedUpdateManyWithoutGameNestedInputSchema).optional(), users: z.lazy(() => User_GameUncheckedUpdateManyWithoutGameNestedInputSchema).optional() }).strict(); export const MoveCreateWithoutUser_gameInputSchema: z.ZodType = z.object({ id: z.string().cuid().optional(), createdAt: z.coerce.date().optional(), - index: z.number().int() + index: z.number().int(), + action: z.lazy(() => MoveTypeSchema), + x: z.number().int(), + y: z.number().int() }).strict(); export const MoveUncheckedCreateWithoutUser_gameInputSchema: z.ZodType = z.object({ id: z.string().cuid().optional(), createdAt: z.coerce.date().optional(), - index: z.number().int() + index: z.number().int(), + action: z.lazy(() => MoveTypeSchema), + x: z.number().int(), + y: z.number().int() }).strict(); export const MoveCreateOrConnectWithoutUser_gameInputSchema: z.ZodType = z.object({ @@ -3196,6 +3693,7 @@ export const GameCreateWithoutUsersInputSchema: z.ZodType ShipCreateNestedManyWithoutGameInputSchema).optional(), gamePin: z.lazy(() => GamepinCreateNestedOneWithoutGameInputSchema).optional() }).strict(); @@ -3208,6 +3706,7 @@ export const GameUncheckedCreateWithoutUsersInputSchema: z.ZodType ShipUncheckedCreateNestedManyWithoutGameInputSchema).optional(), gamePin: z.lazy(() => GamepinUncheckedCreateNestedOneWithoutGameInputSchema).optional() }).strict(); @@ -3268,6 +3767,9 @@ export const MoveScalarWhereInputSchema: z.ZodType id: z.union([ z.lazy(() => StringFilterSchema),z.string() ]).optional(), createdAt: z.union([ z.lazy(() => DateTimeFilterSchema),z.coerce.date() ]).optional(), index: z.union([ z.lazy(() => IntFilterSchema),z.number() ]).optional(), + action: z.union([ z.lazy(() => EnumMoveTypeFilterSchema),z.lazy(() => MoveTypeSchema) ]).optional(), + x: z.union([ z.lazy(() => IntFilterSchema),z.number() ]).optional(), + y: z.union([ z.lazy(() => IntFilterSchema),z.number() ]).optional(), user_game_id: z.union([ z.lazy(() => StringFilterSchema),z.string() ]).optional(), }).strict(); @@ -3312,6 +3814,7 @@ export const GameUpdateWithoutUsersInputSchema: z.ZodType BoolFieldUpdateOperationsInputSchema) ]).optional(), allowChat: z.union([ z.boolean(),z.lazy(() => BoolFieldUpdateOperationsInputSchema) ]).optional(), allowMarkDraw: z.union([ z.boolean(),z.lazy(() => BoolFieldUpdateOperationsInputSchema) ]).optional(), + ships: z.lazy(() => ShipUpdateManyWithoutGameNestedInputSchema).optional(), gamePin: z.lazy(() => GamepinUpdateOneWithoutGameNestedInputSchema).optional() }).strict(); @@ -3324,6 +3827,7 @@ export const GameUncheckedUpdateWithoutUsersInputSchema: z.ZodType BoolFieldUpdateOperationsInputSchema) ]).optional(), allowChat: z.union([ z.boolean(),z.lazy(() => BoolFieldUpdateOperationsInputSchema) ]).optional(), allowMarkDraw: z.union([ z.boolean(),z.lazy(() => BoolFieldUpdateOperationsInputSchema) ]).optional(), + ships: z.lazy(() => ShipUncheckedUpdateManyWithoutGameNestedInputSchema).optional(), gamePin: z.lazy(() => GamepinUncheckedUpdateOneWithoutGameNestedInputSchema).optional() }).strict(); @@ -3572,6 +4076,14 @@ export const SessionUncheckedUpdateManyWithoutSessionsInputSchema: z.ZodType DateTimeFieldUpdateOperationsInputSchema) ]).optional(), }).strict(); +export const ShipCreateManyGameInputSchema: z.ZodType = z.object({ + id: z.string().cuid().optional(), + size: z.number().int(), + variant: z.number().int(), + x: z.number().int(), + y: z.number().int() +}).strict(); + export const User_GameCreateManyGameInputSchema: z.ZodType = z.object({ id: z.string().cuid().optional(), createdAt: z.coerce.date().optional(), @@ -3579,6 +4091,30 @@ export const User_GameCreateManyGameInputSchema: z.ZodType = z.object({ + id: z.union([ z.string().cuid(),z.lazy(() => StringFieldUpdateOperationsInputSchema) ]).optional(), + size: z.union([ z.number().int(),z.lazy(() => IntFieldUpdateOperationsInputSchema) ]).optional(), + variant: z.union([ z.number().int(),z.lazy(() => IntFieldUpdateOperationsInputSchema) ]).optional(), + x: z.union([ z.number().int(),z.lazy(() => IntFieldUpdateOperationsInputSchema) ]).optional(), + y: z.union([ z.number().int(),z.lazy(() => IntFieldUpdateOperationsInputSchema) ]).optional(), +}).strict(); + +export const ShipUncheckedUpdateWithoutGameInputSchema: z.ZodType = z.object({ + id: z.union([ z.string().cuid(),z.lazy(() => StringFieldUpdateOperationsInputSchema) ]).optional(), + size: z.union([ z.number().int(),z.lazy(() => IntFieldUpdateOperationsInputSchema) ]).optional(), + variant: z.union([ z.number().int(),z.lazy(() => IntFieldUpdateOperationsInputSchema) ]).optional(), + x: z.union([ z.number().int(),z.lazy(() => IntFieldUpdateOperationsInputSchema) ]).optional(), + y: z.union([ z.number().int(),z.lazy(() => IntFieldUpdateOperationsInputSchema) ]).optional(), +}).strict(); + +export const ShipUncheckedUpdateManyWithoutShipsInputSchema: z.ZodType = z.object({ + id: z.union([ z.string().cuid(),z.lazy(() => StringFieldUpdateOperationsInputSchema) ]).optional(), + size: z.union([ z.number().int(),z.lazy(() => IntFieldUpdateOperationsInputSchema) ]).optional(), + variant: z.union([ z.number().int(),z.lazy(() => IntFieldUpdateOperationsInputSchema) ]).optional(), + x: z.union([ z.number().int(),z.lazy(() => IntFieldUpdateOperationsInputSchema) ]).optional(), + y: z.union([ z.number().int(),z.lazy(() => IntFieldUpdateOperationsInputSchema) ]).optional(), +}).strict(); + export const User_GameUpdateWithoutGameInputSchema: z.ZodType = z.object({ id: z.union([ z.string().cuid(),z.lazy(() => StringFieldUpdateOperationsInputSchema) ]).optional(), createdAt: z.union([ z.coerce.date(),z.lazy(() => DateTimeFieldUpdateOperationsInputSchema) ]).optional(), @@ -3607,7 +4143,10 @@ export const User_GameUncheckedUpdateManyWithoutUsersInputSchema: z.ZodType = z.object({ id: z.string().cuid().optional(), createdAt: z.coerce.date().optional(), - index: z.number().int() + index: z.number().int(), + action: z.lazy(() => MoveTypeSchema), + x: z.number().int(), + y: z.number().int() }).strict(); export const ChatCreateManyUser_gameInputSchema: z.ZodType = z.object({ @@ -3621,18 +4160,27 @@ export const MoveUpdateWithoutUser_gameInputSchema: z.ZodType StringFieldUpdateOperationsInputSchema) ]).optional(), createdAt: z.union([ z.coerce.date(),z.lazy(() => DateTimeFieldUpdateOperationsInputSchema) ]).optional(), index: z.union([ z.number().int(),z.lazy(() => IntFieldUpdateOperationsInputSchema) ]).optional(), + action: z.union([ z.lazy(() => MoveTypeSchema),z.lazy(() => EnumMoveTypeFieldUpdateOperationsInputSchema) ]).optional(), + x: z.union([ z.number().int(),z.lazy(() => IntFieldUpdateOperationsInputSchema) ]).optional(), + y: z.union([ z.number().int(),z.lazy(() => IntFieldUpdateOperationsInputSchema) ]).optional(), }).strict(); export const MoveUncheckedUpdateWithoutUser_gameInputSchema: z.ZodType = z.object({ id: z.union([ z.string().cuid(),z.lazy(() => StringFieldUpdateOperationsInputSchema) ]).optional(), createdAt: z.union([ z.coerce.date(),z.lazy(() => DateTimeFieldUpdateOperationsInputSchema) ]).optional(), index: z.union([ z.number().int(),z.lazy(() => IntFieldUpdateOperationsInputSchema) ]).optional(), + action: z.union([ z.lazy(() => MoveTypeSchema),z.lazy(() => EnumMoveTypeFieldUpdateOperationsInputSchema) ]).optional(), + x: z.union([ z.number().int(),z.lazy(() => IntFieldUpdateOperationsInputSchema) ]).optional(), + y: z.union([ z.number().int(),z.lazy(() => IntFieldUpdateOperationsInputSchema) ]).optional(), }).strict(); export const MoveUncheckedUpdateManyWithoutMovesInputSchema: z.ZodType = z.object({ id: z.union([ z.string().cuid(),z.lazy(() => StringFieldUpdateOperationsInputSchema) ]).optional(), createdAt: z.union([ z.coerce.date(),z.lazy(() => DateTimeFieldUpdateOperationsInputSchema) ]).optional(), index: z.union([ z.number().int(),z.lazy(() => IntFieldUpdateOperationsInputSchema) ]).optional(), + action: z.union([ z.lazy(() => MoveTypeSchema),z.lazy(() => EnumMoveTypeFieldUpdateOperationsInputSchema) ]).optional(), + x: z.union([ z.number().int(),z.lazy(() => IntFieldUpdateOperationsInputSchema) ]).optional(), + y: z.union([ z.number().int(),z.lazy(() => IntFieldUpdateOperationsInputSchema) ]).optional(), }).strict(); export const ChatUpdateWithoutUser_gameInputSchema: z.ZodType = z.object({ @@ -3903,6 +4451,68 @@ export const VerificationTokenFindUniqueOrThrowArgsSchema: z.ZodType = z.object({ + select: ShipSelectSchema.optional(), + include: ShipIncludeSchema.optional(), + where: ShipWhereInputSchema.optional(), + orderBy: z.union([ ShipOrderByWithRelationInputSchema.array(),ShipOrderByWithRelationInputSchema ]).optional(), + cursor: ShipWhereUniqueInputSchema.optional(), + take: z.number().optional(), + skip: z.number().optional(), + distinct: ShipScalarFieldEnumSchema.array().optional(), +}).strict() + +export const ShipFindFirstOrThrowArgsSchema: z.ZodType = z.object({ + select: ShipSelectSchema.optional(), + include: ShipIncludeSchema.optional(), + where: ShipWhereInputSchema.optional(), + orderBy: z.union([ ShipOrderByWithRelationInputSchema.array(),ShipOrderByWithRelationInputSchema ]).optional(), + cursor: ShipWhereUniqueInputSchema.optional(), + take: z.number().optional(), + skip: z.number().optional(), + distinct: ShipScalarFieldEnumSchema.array().optional(), +}).strict() + +export const ShipFindManyArgsSchema: z.ZodType = z.object({ + select: ShipSelectSchema.optional(), + include: ShipIncludeSchema.optional(), + where: ShipWhereInputSchema.optional(), + orderBy: z.union([ ShipOrderByWithRelationInputSchema.array(),ShipOrderByWithRelationInputSchema ]).optional(), + cursor: ShipWhereUniqueInputSchema.optional(), + take: z.number().optional(), + skip: z.number().optional(), + distinct: ShipScalarFieldEnumSchema.array().optional(), +}).strict() + +export const ShipAggregateArgsSchema: z.ZodType = z.object({ + where: ShipWhereInputSchema.optional(), + orderBy: z.union([ ShipOrderByWithRelationInputSchema.array(),ShipOrderByWithRelationInputSchema ]).optional(), + cursor: ShipWhereUniqueInputSchema.optional(), + take: z.number().optional(), + skip: z.number().optional(), +}).strict() + +export const ShipGroupByArgsSchema: z.ZodType = z.object({ + where: ShipWhereInputSchema.optional(), + orderBy: z.union([ ShipOrderByWithAggregationInputSchema.array(),ShipOrderByWithAggregationInputSchema ]).optional(), + by: ShipScalarFieldEnumSchema.array(), + having: ShipScalarWhereWithAggregatesInputSchema.optional(), + take: z.number().optional(), + skip: z.number().optional(), +}).strict() + +export const ShipFindUniqueArgsSchema: z.ZodType = z.object({ + select: ShipSelectSchema.optional(), + include: ShipIncludeSchema.optional(), + where: ShipWhereUniqueInputSchema, +}).strict() + +export const ShipFindUniqueOrThrowArgsSchema: z.ZodType = z.object({ + select: ShipSelectSchema.optional(), + include: ShipIncludeSchema.optional(), + where: ShipWhereUniqueInputSchema, +}).strict() + export const GameFindFirstArgsSchema: z.ZodType = z.object({ select: GameSelectSchema.optional(), include: GameIncludeSchema.optional(), @@ -4373,6 +4983,47 @@ export const VerificationTokenDeleteManyArgsSchema: z.ZodType = z.object({ + select: ShipSelectSchema.optional(), + include: ShipIncludeSchema.optional(), + data: z.union([ ShipCreateInputSchema,ShipUncheckedCreateInputSchema ]), +}).strict() + +export const ShipUpsertArgsSchema: z.ZodType = z.object({ + select: ShipSelectSchema.optional(), + include: ShipIncludeSchema.optional(), + where: ShipWhereUniqueInputSchema, + create: z.union([ ShipCreateInputSchema,ShipUncheckedCreateInputSchema ]), + update: z.union([ ShipUpdateInputSchema,ShipUncheckedUpdateInputSchema ]), +}).strict() + +export const ShipCreateManyArgsSchema: z.ZodType = z.object({ + data: z.union([ ShipCreateManyInputSchema,ShipCreateManyInputSchema.array() ]), + skipDuplicates: z.boolean().optional(), +}).strict() + +export const ShipDeleteArgsSchema: z.ZodType = z.object({ + select: ShipSelectSchema.optional(), + include: ShipIncludeSchema.optional(), + where: ShipWhereUniqueInputSchema, +}).strict() + +export const ShipUpdateArgsSchema: z.ZodType = z.object({ + select: ShipSelectSchema.optional(), + include: ShipIncludeSchema.optional(), + data: z.union([ ShipUpdateInputSchema,ShipUncheckedUpdateInputSchema ]), + where: ShipWhereUniqueInputSchema, +}).strict() + +export const ShipUpdateManyArgsSchema: z.ZodType = z.object({ + data: z.union([ ShipUpdateManyMutationInputSchema,ShipUncheckedUpdateManyInputSchema ]), + where: ShipWhereInputSchema.optional(), +}).strict() + +export const ShipDeleteManyArgsSchema: z.ZodType = z.object({ + where: ShipWhereInputSchema.optional(), +}).strict() + export const GameCreateArgsSchema: z.ZodType = z.object({ select: GameSelectSchema.optional(), include: GameIncludeSchema.optional(), diff --git a/leaky-ships/prisma/schema.prisma b/leaky-ships/prisma/schema.prisma index 0d572c9..ae218f5 100644 --- a/leaky-ships/prisma/schema.prisma +++ b/leaky-ships/prisma/schema.prisma @@ -75,11 +75,22 @@ enum GameState { ended } +model Ship { + id String @id @default(cuid()) + size Int + variant Int + x Int + y Int + gameId String + game Game @relation(fields: [gameId], references: [id], onDelete: Cascade) +} + model Game { id String @id @default(cuid()) createdAt DateTime @default(now()) updatedAt DateTime @updatedAt state GameState @default(lobby) + ships Ship[] allowSpectators Boolean @default(true) allowSpecials Boolean @default(true) allowChat Boolean @default(true) @@ -111,14 +122,25 @@ model User_Game { @@unique([gameId, userId]) } +enum MoveType { + radar + htorpedo + vtorpedo + missile +} + model Move { id String @id @default(cuid()) createdAt DateTime @default(now()) index Int + action MoveType + x Int + y Int user_game_id String user_game User_Game @relation(fields: [user_game_id], references: [id], onDelete: Cascade) @@unique([user_game_id, index]) + @@unique([action, x, y]) } model Chat { diff --git a/leaky-ships/styles/App.scss b/leaky-ships/styles/App.scss index ea4df20..0371281 100644 --- a/leaky-ships/styles/App.scss +++ b/leaky-ships/styles/App.scss @@ -108,7 +108,7 @@ body { position: relative; @include flex-col; align-items: center; - grid-row: var(--x); + grid-row: var(--y); pointer-events: none; img { @@ -119,16 +119,31 @@ body { // object-fit: cover; } + &.interactive:not(.preview) { + pointer-events: auto; + } + + &.preview { + border: 2px dashed orange; + border-radius: 0.5rem; + animation: blink 0.5s ease-in-out alternate infinite; + @keyframes blink { + from { + opacity: 0.2; + } + } + } + &.s2 { - grid-column: var(--y) / 5; + grid-column: var(--x) / calc(var(--x) + 2); } &.s3 { - grid-column: var(--y) / 6; + grid-column: var(--x) / calc(var(--x) + 3); } &.s4 { - grid-column: var(--y) / 7; + grid-column: var(--x) / calc(var(--x) + 4); } } @@ -285,8 +300,8 @@ body { &.left { transform: rotate(90deg); - animation: floatInl 3s ease-out; - @keyframes floatInl { + animation: floatInLe 3s ease-out; + @keyframes floatInLe { from { transform: scale(2) rotate(90deg); margin-left: -324px; @@ -297,8 +312,8 @@ body { &.right { transform: rotate(270deg); - animation: floatInr 3s ease-out; - @keyframes floatInr { + animation: floatInRi 3s ease-out; + @keyframes floatInRi { from { transform: scale(2) rotate(270deg); margin-left: 324px; @@ -307,8 +322,8 @@ body { } } &.top { - animation: floatInt 3s ease-out; - @keyframes floatInt { + animation: floatInTop 3s ease-out; + @keyframes floatInTop { from { transform: scale(2); margin-top: 648px; @@ -319,8 +334,8 @@ body { &.bottom { transform: rotate(180deg); - animation: floatInb 3s ease-out; - @keyframes floatInb { + animation: floatInBot 3s ease-out; + @keyframes floatInBot { from { transform: scale(2) rotate(180deg); margin-top: 0; @@ -331,12 +346,18 @@ body { &.middle { grid-area: 4 / 4 / -4 / -4; + transform: scale(1.5); + animation: floatInMid 3s ease-in-out; + @keyframes floatInMid { + from { + opacity: 0; + } + } } } canvas { grid-area: 1 / 1 / -1 / -1; - border: 1px solid #000; border-radius: 0.5rem; z-index: 1; } @@ -379,6 +400,9 @@ body { background-color: white; border-radius: 1rem; + &.enabled { + box-shadow: 0 0 0.5rem 0.25rem royalblue; + } &.disabled { box-shadow: inset 0 0 1rem 1rem #888; }