/**
 * MSW handlers for current user account endpoints.
 * @module mocks/handlers/account
 */
import { http, HttpResponse } from "msw";
import myAccountData from "../fixtures/my-account.json";
import { captureRequest } from "../request-log.js";

export const accountHandlers = [
  http.get("/api/my-account", ({ request }) => {
    captureRequest("GET", "/api/my-account");
    return HttpResponse.json(myAccountData);
  }),

  http.put("/api/my-account", async ({ request }) => {
    const body = await request.json();
    captureRequest("PUT", "/api/my-account", body);
    return HttpResponse.json({ success: true });
  }),
];
