import { z } from "zod/v4";

import { adminProcedure, createTRPCRouter } from "~/server/api/trpc";
import {
	exportUserToFIC,
	getClientFromCF,
} from "~/server/controllers/fic.controller";
import { zUserId } from "~/server/utils/zod_types";

export const fattureRouter = createTRPCRouter({
	getClientFromCF: adminProcedure
		.input(
			z.object({
				cf: z.string(),
			}),
		)
		.query(async ({ input }) => {
			return await getClientFromCF(input.cf);
		}),
	addToFIC: adminProcedure
		.input(
			z.object({
				userId: zUserId,
			}),
		)
		.mutation(async ({ input }) => {
			return await exportUserToFIC(input.userId);
		}),
});
