import { createTRPCRouter, controllerProcedure, planningReadProcedure } from "../trpc.js";
import {
  applyScenario,
  getProjectScenarioBaseline,
  ScenarioProjectIdInputSchema,
  ScenarioSimulationInputSchema,
  simulateScenario,
} from "./scenario-procedure-support.js";

export const scenarioRouter = createTRPCRouter({
  getProjectBaseline: planningReadProcedure
    .input(ScenarioProjectIdInputSchema)
    .query(({ ctx, input }) => getProjectScenarioBaseline(ctx, input)),

  simulate: controllerProcedure
    .input(ScenarioSimulationInputSchema)
    .mutation(({ ctx, input }) => simulateScenario(ctx, input)),

  applyScenario: controllerProcedure
    .input(ScenarioSimulationInputSchema)
    .mutation(({ ctx, input }) => applyScenario(ctx, input)),
});
