import { adminProcedure, createTRPCRouter, planningReadProcedure } from "../trpc.js";
import {
  CreateUtilizationCategoryInputSchema,
  UpdateUtilizationCategoryInputSchema,
  UtilizationCategoryByIdInputSchema,
  UtilizationCategoryListInputSchema,
  createUtilizationCategory,
  getUtilizationCategoryById,
  listUtilizationCategories,
  updateUtilizationCategory,
} from "./utilization-category-procedure-support.js";

export const utilizationCategoryRouter = createTRPCRouter({
  list: planningReadProcedure
    .input(UtilizationCategoryListInputSchema)
    .query(({ ctx, input }) => listUtilizationCategories(ctx, input)),

  getById: planningReadProcedure
    .input(UtilizationCategoryByIdInputSchema)
    .query(({ ctx, input }) => getUtilizationCategoryById(ctx, input)),

  create: adminProcedure
    .input(CreateUtilizationCategoryInputSchema)
    .mutation(({ ctx, input }) => createUtilizationCategory(ctx, input)),

  update: adminProcedure
    .input(UpdateUtilizationCategoryInputSchema)
    .mutation(({ ctx, input }) => updateUtilizationCategory(ctx, input)),
});
