import { vi } from "vitest";

vi.mock("@capakraken/application", async (importOriginal) => {
  const actual = await importOriginal<typeof import("@capakraken/application")>();
  return {
    ...actual,
    countPlanningEntries: vi.fn().mockResolvedValue({ countsByRoleId: new Map() }),
    getDashboardBudgetForecast: vi.fn().mockResolvedValue([]),
    getDashboardPeakTimes: vi.fn().mockResolvedValue([]),
    listAssignmentBookings: vi.fn().mockResolvedValue([]),
  };
});

import { countPlanningEntries } from "@capakraken/application";
import { executeTool as executeAssistantTool } from "../router/assistant-tools.js";

export { createToolContext } from "./assistant-tools-master-data-mutation-test-helpers.js";

export function resetRoleMutationMocks() {
  vi.clearAllMocks();
  vi.mocked(countPlanningEntries).mockResolvedValue({ countsByRoleId: new Map() });
}

export function createRoleRecord(overrides: Record<string, unknown> = {}) {
  return {
    id: "role_1",
    name: "Senior CG Artist",
    description: "Pipeline lead",
    color: "#222222",
    isActive: true,
    _count: { resourceRoles: 0 },
    resourceRoles: [],
    ...overrides,
  };
}

export const executeTool = executeAssistantTool;
