import { NextResponse } from "next/server";
import { getAuthFromRequest } from "@open-mercato/shared/lib/auth/server";
import { createRequestContainer } from "@open-mercato/shared/lib/di/container";
import { paymentGatewaysTag } from "../openapi.js";
const metadata = {
  path: "/payment_gateways/providers",
  GET: { requireAuth: true, requireFeatures: ["payment_gateways.view"] }
};
async function GET(request) {
  const auth = await getAuthFromRequest(request);
  if (!auth?.tenantId || !auth.orgId) {
    return NextResponse.json({ error: "Unauthorized" }, { status: 401 });
  }
  const { resolve } = await createRequestContainer();
  const descriptorService = resolve("paymentGatewayDescriptorService");
  const items = await descriptorService.listResolved({
    organizationId: auth.orgId,
    tenantId: auth.tenantId
  });
  return NextResponse.json({ items });
}
const openApi = {
  tags: [paymentGatewaysTag],
  summary: "List payment gateway descriptors",
  methods: {
    GET: {
      summary: "List payment gateway descriptors",
      tags: [paymentGatewaysTag],
      responses: [{ status: 200, description: "List of safe payment gateway descriptors" }]
    }
  }
};
var route_default = GET;
export {
  GET,
  route_default as default,
  metadata,
  openApi
};
//# sourceMappingURL=route.js.map
