import { ShiftProjectSchema } from "@capakraken/shared";
import { controllerProcedure } from "../trpc.js";
import {
  TimelineProjectContextDetailSchema,
  TimelineProjectIdSchema,
} from "./timeline-read-schema-support.js";
import {
  readTimelineProjectContextDetailResponse,
  readTimelineProjectContextResponse,
} from "./timeline-project-context-procedure-support.js";
import {
  readTimelineProjectBudgetStatusResponse,
  readTimelineProjectShiftPreview,
  readTimelineProjectShiftPreviewDetail,
} from "./timeline-project-procedure-support.js";

export const timelineProjectReadProcedures = {
  getProjectContext: controllerProcedure
    .input(TimelineProjectIdSchema)
    .query(async ({ ctx, input }) => readTimelineProjectContextResponse(ctx.db, input.projectId)),

  getProjectContextDetail: controllerProcedure
    .input(TimelineProjectContextDetailSchema)
    .query(async ({ ctx, input }) => readTimelineProjectContextDetailResponse(ctx.db, input)),

  previewShift: controllerProcedure
    .input(ShiftProjectSchema)
    .query(async ({ ctx, input }) => readTimelineProjectShiftPreview(ctx.db, input)),

  getShiftPreviewDetail: controllerProcedure
    .input(ShiftProjectSchema)
    .query(async ({ ctx, input }) => readTimelineProjectShiftPreviewDetail(ctx.db, input)),

  getBudgetStatus: controllerProcedure
    .input(TimelineProjectIdSchema)
    .query(async ({ ctx, input }) => readTimelineProjectBudgetStatusResponse(ctx.db, input.projectId)),
};
