import { jsonSuccess } from "@/modules/core/server/api";
import { requirePermission } from "@/modules/core/server/auth";
import { PERMISSION_DEFINITIONS } from "@/modules/core/server/permissions";

export async function GET(): Promise<Response> {
  const auth = await requirePermission("permission:read", {
    action: "permission.list",
    targetType: "permission",
  });

  if (!auth.success) {
    return auth.response;
  }

  return jsonSuccess("权限点已加载", { permissions: PERMISSION_DEFINITIONS });
}
