import { AmountSchema, MetadataSchema, PercentageSchema, QuantitySchema } from "@erp/core";
import { z } from "zod/v4";

export const UpdateCustomerInvoiceByIdResponseSchema = z.object({
  id: z.uuid(),
  company_id: z.uuid(),

  invoice_number: z.string(),
  status: z.string(),
  series: z.string(),

  invoice_date: z.string(),
  operation_date: z.string(),

  notes: z.string(),

  language_code: z.string(),
  currency_code: z.string(),

  subtotal_amount: AmountSchema,
  discount_percentage: PercentageSchema,
  discount_amount: AmountSchema,
  taxable_amount: AmountSchema,
  tax_amount: AmountSchema,
  total_amount: AmountSchema,

  items: z.array(
    z.object({
      id: z.uuid(),
      position: z.string(),
      description: z.string(),
      quantity: QuantitySchema,
      unit_amount: AmountSchema,
      discount_percentage: PercentageSchema,
      total_amount: AmountSchema,
    })
  ),

  metadata: MetadataSchema.optional(),
});

export type UpdateCustomerInvoiceByIdResponseDTO = z.infer<
  typeof UpdateCustomerInvoiceByIdResponseSchema
>;
