import { controllerProcedure, createTRPCRouter, managerProcedure } from "../trpc.js";
import {
  exportProjectsCsv,
  exportResourcesCsv,
  importCsv,
  importCsvInputSchema,
} from "./import-export-procedure-support.js";

export const importExportRouter = createTRPCRouter({
  exportResourcesCSV: controllerProcedure.query(({ ctx }) => exportResourcesCsv(ctx)),

  exportProjectsCSV: controllerProcedure.query(({ ctx }) => exportProjectsCsv(ctx)),

  importCSV: managerProcedure
    .input(importCsvInputSchema)
    .mutation(({ ctx, input }) => importCsv(ctx, input)),
});
