// src/components/docs/integrations/IntegrationsCircuitBreakersPage.tsx
import { jsx, jsxs } from "react/jsx-runtime";
function IntegrationsCircuitBreakersPage() {
  return /* @__PURE__ */ jsxs("div", {
    className: "space-y-8",
    children: [
      /* @__PURE__ */ jsxs("div", {
        className: "space-y-4",
        children: [
          /* @__PURE__ */ jsx("h1", {
            className: "text-4xl font-bold",
            children: "Integration Circuit Breakers"
          }),
          /* @__PURE__ */ jsx("p", {
            className: "text-muted-foreground text-lg",
            children: "External APIs are the most common source of instability. Wrap every integration call in a circuit breaker to protect your system."
          })
        ]
      }),
      /* @__PURE__ */ jsxs("div", {
        className: "space-y-4",
        children: [
          /* @__PURE__ */ jsx("h2", {
            className: "text-2xl font-bold",
            children: "Pattern"
          }),
          /* @__PURE__ */ jsx("p", {
            children: "Create a dedicated circuit breaker instance for each external service. This ensures that a failure in Stripe doesn't trigger the circuit breaker for Twilio."
          }),
          /* @__PURE__ */ jsx("pre", {
            className: "bg-muted rounded-lg border p-4 text-sm",
            children: `// integrations/stripe.ts
import { CircuitBreaker } from '@contractspec/lib.resilience/circuit-breaker';

const stripeBreaker = new CircuitBreaker({
  failureThreshold: 10,
  resetTimeoutMs: 60000,
});

export async function createCharge(amount: number) {
  return stripeBreaker.execute(() => stripe.charges.create({ amount }));
}`
          })
        ]
      })
    ]
  });
}
export {
  IntegrationsCircuitBreakersPage
};
