|
1
|
import { z } from "zod" |
|
2
|
|
|
3
|
const LocationQuantitySchema = z.object({ |
|
4
|
id: z.string().optional(), |
|
5
|
quantity: z.union([z.number(), z.string()]), |
|
6
|
checked: z.boolean(), |
|
7
|
disabledToggle: z.boolean(), |
|
8
|
}) |
|
9
|
|
|
10
|
const InventoryLocationsSchema = z.record(z.string(), LocationQuantitySchema) |
|
11
|
|
|
12
|
const InventoryItemSchema = z.object({ |
|
13
|
locations: InventoryLocationsSchema, |
|
14
|
}) |
|
15
|
|
|
16
|
export const InventoryStockSchema = z.object({ |
|
17
|
inventory_items: z.record(z.string(), InventoryItemSchema), |
|
18
|
}) |
|
19
|
|
|
20
|
export type InventoryLocationsSchema = z.infer<typeof InventoryLocationsSchema> |
|
21
|
export type InventoryItemSchema = z.infer<typeof InventoryItemSchema> |
|
22
|
export type InventoryStockSchema = z.infer<typeof InventoryStockSchema> |