import { z } from "zod"

export const assetSchema = z.object({
  id: z.string().optional(),
  itemId: z.string().min(1, { message: "Item is required" }),
  serialNumber: z.string().min(1, { message: "Serial number is required" }),
  deliveryNote: z.string().optional(),
  notes: z.string().optional(),
  recipientId: z.string().optional(),
})

export const createAssetSchema = assetSchema.extend({
  status: z.enum(["AVAILABLE", "ASSIGNED"]),
})

export type CreateAssetFormType = z.infer<typeof createAssetSchema>

export const updateAssetSchema = assetSchema.extend({
  id: z.string().min(1, { message: "ID is required" }),
  status: z.enum(["AVAILABLE", "ASSIGNED", "RESERVED", "IN_REPAIR"]),
})

export type UpdateAssetFormType = z.infer<typeof updateAssetSchema>
