import { z } from 'zod';

/**
 * Payload column for `macsync.calendar_send_queue` rows. All fields are
 * optional because the same payload shape covers create/update/delete:
 *  - create_event: `calendarIdentifier` + event fields
 *  - update_event: `eventIdentifier` + changed fields
 *  - delete_event: `eventIdentifier`
 */
export const calendarSendPayloadSchema = z.object({
  eventIdentifier: z.string().optional(),
  calendarIdentifier: z.string().optional(),
  title: z.string().optional(),
  notes: z.string().optional(),
  location: z.string().optional(),
  startDate: z.string().optional(),
  endDate: z.string().optional(),
  isAllDay: z.boolean().optional(),
  url: z.string().optional(),
});

export type CalendarSendPayload = z.infer<typeof calendarSendPayloadSchema>;

export const CALENDAR_SEND_ACTIONS = ['create_event', 'update_event', 'delete_event'] as const;
export type CalendarSendAction = (typeof CALENDAR_SEND_ACTIONS)[number];
