import {z} from 'zod'

export const meetingSchema = z.object({
  id: z.uuid(),
  title: z.string().min(3, {error: 'The title must be a least 3 characters long.'}),
  contactId: z.uuid({error: 'Please specify a contact.'}),
  date: z.preprocess(
    date => (typeof date === 'string' ? new Date(date) : date),
    z.date().min(new Date(), {error: "You can't schedule a meeting earlier than today"}),
  ),
  description: z.string(),
})

export const createMeetingSchema = meetingSchema.omit({id: true})
export const updateMeetingSchema = meetingSchema
export const deleteMeetingSchema = meetingSchema.pick({id: true})
