import { z } from "zod"

const relationFieldSchema = z
    .object({ value: z.string(), label: z.string() })
    .nullable()

const paymentMadeFormSchema = z.object({
    // ── Relations ──
    vendor: relationFieldSchema,
    employee: relationFieldSchema,
    payment_mode: relationFieldSchema,

    // ── Payment info ──
    payment_for: z.string().min(1, "Payment for is required"),
    payment_made: z.string().min(1, "Amount is required"),
    payment_number: z.string().optional(),
    payment_reference: z.string().optional(),
    payment_date: z.string().min(1, "Payment date is required"),
    paid_through: z.string().optional(),
    notes: z.string().optional(),
})

type PaymentMadeFormValues = z.infer<typeof paymentMadeFormSchema>

export { paymentMadeFormSchema, relationFieldSchema }
export type { PaymentMadeFormValues }
