import { getCurrentAuthContext } from "@/modules/core/server/auth";
import { jsonSuccess } from "@/modules/core/server/api";

export const dynamic = "force-dynamic";

export async function GET(): Promise<Response> {
  const context = await getCurrentAuthContext();

  return jsonSuccess("Session loaded", {
    account: context?.account ?? null,
    organization: context?.organization ?? null,
    organizations: context?.organizations ?? [],
    membership: context?.membership ?? null,
    permissions: context?.permissions ?? [],
  });
}
