import {
  NotificationChannels,
  NotificationPriorities,
  NotificationTargetGroups,
  NotificationTypes,
} from "@/constants/enums";
import { z } from "zod";
import { createApiResponseSchema } from "./Factory";

export const notificationSchema = z.object({
  created_at: z.string(),
  event_type: z.string(),
  id: z.string(),
  image: z.string(),
  is_scheduled: z.boolean(),
  link: z.string(),
  message: z.string(),
  metadata: z.object({
    additionalProp1: z.string(),
    additionalProp2: z.string(),
    additionalProp3: z.string(),
  }),
  method: z.object({
    additionalProp1: z.string(),
    additionalProp2: z.string(),
    additionalProp3: z.string(),
  }),
  priority: z.string(),
  schedule_at: z.number(),
  scheduled_at: z.number(),
  seen: z.boolean(),
  seen_at: z.number(),
  status: z.string(),
  title: z.string(),
  type: z.string(),
  updated_at: z.string(),
  user_id: z.string(),
});
const createNotificationCredentialsSchema = z.object({
  channels: z.array(z.enum(NotificationChannels)),
  description: z.string(),
  link: z.string(),
  priority: z.enum(NotificationPriorities),
  recipient: z.array(z.string()).optional(),
  schedule_at: z.number(),
  target: z.enum(NotificationTargetGroups),
  tender: z.string(),
  title: z.string(),
  type: z.enum(NotificationTypes),
});
const notificationHistoryResponseSchema = createApiResponseSchema(
  z.array(notificationSchema),
);
export type TNotificationHistory = z.infer<typeof notificationSchema>;
export type TNotificationDetailsResponse = z.infer<typeof notificationSchema>;
export type TCreateNotificationCredentials = z.infer<
  typeof createNotificationCredentialsSchema
>;
export type TNotificationHistoryResponse = z.infer<
  typeof notificationHistoryResponseSchema
>;
