import { NextResponse } from "next/server";
import { getAuthFromRequest } from "@open-mercato/shared/lib/auth/server";
import { listShippingAdapters } from "../../lib/adapter-registry.js";
import { shippingCarriersTag } from "../openapi.js";
const metadata = {
  path: "/shipping-carriers/providers",
  GET: { requireAuth: true, requireFeatures: ["shipping_carriers.manage"] }
};
async function GET(req) {
  const auth = await getAuthFromRequest(req);
  if (!auth?.tenantId || !auth.orgId) {
    return NextResponse.json({ error: "Unauthorized" }, { status: 401 });
  }
  const adapters = listShippingAdapters();
  const providers = adapters.map((adapter) => ({
    providerKey: adapter.providerKey
  }));
  return NextResponse.json({ providers });
}
const openApi = {
  tags: [shippingCarriersTag],
  summary: "List registered shipping providers",
  methods: {
    GET: {
      summary: "List registered shipping providers",
      tags: [shippingCarriersTag],
      responses: [
        { status: 200, description: "List of registered provider keys" }
      ]
    }
  }
};
export {
  GET,
  metadata,
  openApi
};
//# sourceMappingURL=route.js.map
