import { z } from "zod";

export const sesEventSchema = z.object({
  eventType: z.enum(["Send", "Delivery", "Bounce", "Complaint", "Reject", "Open", "Click"]),
  mail: z.object({
    messageId: z.string(),
    destination: z.array(z.string()).optional(),
  }),
  bounce: z
    .object({
      bounceType: z.enum(["Undetermined", "Permanent", "Transient"]),
      bouncedRecipients: z.array(z.object({ emailAddress: z.string() })),
    })
    .optional(),
  complaint: z
    .object({
      complainedRecipients: z.array(z.object({ emailAddress: z.string() })),
    })
    .optional(),
});

export type SesEvent = z.infer<typeof sesEventSchema>;
