import { PriceValueSchema, TouchBaseSchema } from '@isa/common/data-access';
import { z } from 'zod';
import { ShippingTypeSchema } from './shipping-type.schema';
import { TypeOfDeliverySchema } from './type-of-delivery.schema';

export const TermsOfDeliverySchema = z
  .object({
    isPartialShipping: z.boolean().describe('Whether partialShipping').optional(),
    partialShippingCharge: z.number().describe('Partial shipping charge').optional(),
    postage: PriceValueSchema.describe('Postage').optional(),
    typeOfDelivery: TypeOfDeliverySchema.describe('Type of delivery').optional(),
    shippingType: ShippingTypeSchema.describe('Shipping type').optional(),
    shippingDeadlineStart: z.string().describe('Shipping deadline start').optional(),
    shippingDeadlineEnd: z.string().describe('Shipping deadline end').optional(),
  })
  .extend(TouchBaseSchema.shape);

export type TermsOfDelivery = z.infer<typeof TermsOfDeliverySchema>;
