import { z } from 'zod'; export const createInventoryItemSchema = z .object({ productId: z.uuid(), conditionId: z.uuid(), notes: z.string().trim().max(10000).optional(), }) .strict(); export const bulkArchiveInventorySchema = z .object({ action: z.literal('ARCHIVE'), inventoryItemIds: z.array(z.uuid()).min(1).max(100), }) .strict(); export const bulkPricingRefreshInventorySchema = z .object({ action: z.literal('PRICING_REFRESH'), inventoryItemIds: z.array(z.uuid()).min(1).max(100), providerId: z.string().trim().min(1).max(100).optional(), }) .strict(); export const bulkTagInventorySchema = z .object({ action: z.literal('TAGS'), inventoryItemIds: z.array(z.uuid()).min(1).max(100), add: z.array(z.string().trim().min(1).max(100)).max(50).optional(), remove: z.array(z.string().trim().min(1).max(100)).max(50).optional(), }) .strict() .refine(({ add, remove }) => (add?.length ?? 0) > 0 || (remove?.length ?? 0) > 0, { message: 'Add or remove at least one tag.', path: ['add'], }); export const bulkInventorySchema = z.discriminatedUnion('action', [ bulkArchiveInventorySchema, bulkPricingRefreshInventorySchema, bulkTagInventorySchema, ]);