import { expect } from "@playwright/test";
import { apiRequest } from "./api.js";
import { deleteStaffEntityIfExists } from "./staffFixtures.js";
async function createTimeProjectFixture(request, token, input) {
  const response = await apiRequest(request, "POST", "/api/staff/timesheets/time-projects", {
    token,
    data: {
      name: input?.name ?? `QA Project ${Date.now()}`,
      code: input?.code ?? `QA-${Date.now()}`,
      projectType: "internal",
      status: "active"
    }
  });
  expect(response.ok(), `Failed to create time project fixture: ${response.status()}`).toBeTruthy();
  const body = await response.json();
  expect(typeof body.id === "string" && body.id.length > 0).toBeTruthy();
  return body.id;
}
async function assignEmployeeToProjectFixture(request, token, projectId, staffMemberId) {
  const response = await apiRequest(request, "POST", `/api/staff/timesheets/time-projects/${projectId}/employees`, {
    token,
    data: { staffMemberId, status: "active", assignedStartDate: (/* @__PURE__ */ new Date()).toISOString().slice(0, 10) }
  });
  expect(response.ok(), `Failed to assign employee to project: ${response.status()}`).toBeTruthy();
  const body = await response.json();
  return body.id ?? "";
}
async function createTimeEntryFixture(request, token, input) {
  const response = await apiRequest(request, "POST", "/api/staff/timesheets/time-entries", {
    token,
    data: {
      staffMemberId: input.staffMemberId,
      timeProjectId: input.timeProjectId,
      date: input.date,
      durationMinutes: input.durationMinutes,
      source: "manual"
    }
  });
  expect(response.ok(), `Failed to create time entry fixture: ${response.status()}`).toBeTruthy();
  const body = await response.json();
  expect(typeof body.id === "string" && body.id.length > 0).toBeTruthy();
  return body.id;
}
export {
  assignEmployeeToProjectFixture,
  createTimeEntryFixture,
  createTimeProjectFixture,
  deleteStaffEntityIfExists
};
//# sourceMappingURL=timesheetFixtures.js.map
