import { createTRPCRouter, adminProcedure } from "../trpc.js";
import { holidayCalendarCatalogReadProcedures } from "./holiday-calendar-catalog-read.js";
import {
  createHolidayCalendar,
  createHolidayCalendarEntry,
  deleteHolidayCalendar,
  deleteHolidayCalendarEntry,
  holidayCalendarEntryUpdateInputSchema,
  holidayCalendarIdInputSchema,
  holidayCalendarUpdateInputSchema,
  updateHolidayCalendar,
  updateHolidayCalendarEntry,
} from "./holiday-calendar-procedure-support.js";
import { holidayCalendarResolutionReadProcedures } from "./holiday-calendar-resolution-read.js";
import {
  CreateHolidayCalendarEntrySchema,
  CreateHolidayCalendarSchema,
} from "@capakraken/shared";

export const holidayCalendarRouter = createTRPCRouter({
  ...holidayCalendarCatalogReadProcedures,
  ...holidayCalendarResolutionReadProcedures,

  createCalendar: adminProcedure
    .input(CreateHolidayCalendarSchema)
    .mutation(({ ctx, input }) => createHolidayCalendar(ctx, input)),

  updateCalendar: adminProcedure
    .input(holidayCalendarUpdateInputSchema)
    .mutation(({ ctx, input }) => updateHolidayCalendar(ctx, input)),

  deleteCalendar: adminProcedure
    .input(holidayCalendarIdInputSchema)
    .mutation(({ ctx, input }) => deleteHolidayCalendar(ctx, input)),

  createEntry: adminProcedure
    .input(CreateHolidayCalendarEntrySchema)
    .mutation(({ ctx, input }) => createHolidayCalendarEntry(ctx, input)),

  updateEntry: adminProcedure
    .input(holidayCalendarEntryUpdateInputSchema)
    .mutation(({ ctx, input }) => updateHolidayCalendarEntry(ctx, input)),

  deleteEntry: adminProcedure
    .input(holidayCalendarIdInputSchema)
    .mutation(({ ctx, input }) => deleteHolidayCalendarEntry(ctx, input)),

});
