import { z } from "zod"

export const movementSchema = z.object({
  type: z.enum(["IN", "OUT", "ASSIGNMENT", "RETURN", "ADJUSTMENT"]),
  quantity: z.coerce
    .number()
    .int()
    .nonnegative()
    .min(1, { message: "Quantity is required" }),
  details: z.string().optional(),
  notes: z.string().optional(),
  itemId: z.string().optional(),
  assetId: z.string().optional(),
  userId: z.string(),
  assignmentId: z.string().optional(),
  recipientId: z.string().optional(),
})

export const createMovementSchema = movementSchema.omit({
  userId: true,
})

export type CreateMovementFormType = z.infer<typeof createMovementSchema>
