import {
  AddressSchema,
  CommunicationDetailsSchema,
  EntityContainerSchema,
  GenderSchema,
  OrganisationSchema,
} from '@isa/common/data-access';
import { z } from 'zod';
import { ShippingTargetSchema } from './shipping-target.schema';
import { BranchSchema } from './branch.schema';

export const DestinationSchema = z.object({
  id: z.number().describe('Unique identifier').optional(),
  createdAt: z.string().describe('Creation timestamp').optional(),
  modifiedAt: z.string().describe('Modified at').optional(),
  address: AddressSchema.describe('Address').optional(),
  communicationDetails: CommunicationDetailsSchema.describe(
    'Communication details',
  ).optional(),
  firstName: z.string().describe('First name').optional(),
  gender: GenderSchema.describe('Gender').default(0),
  lastName: z.string().describe('Last name').optional(),
  locale: z.string().describe('Locale').optional(),
  organisation: OrganisationSchema.describe(
    'Organisation information',
  ).optional(),
  title: z.string().describe('Title').optional(),
  target: ShippingTargetSchema.describe('Target').optional(),
  targetBranch: EntityContainerSchema(BranchSchema)
    .describe('Target branch')
    .optional(),
});
