// @bun
// src/components/docs/intent/OpenapiAlternativePage.tsx
import { openapiAlternativeBrief } from "@contractspec/bundle.library/components/docs/intent/intent-pages.docblocks";
import { SeoOptimizer } from "@contractspec/lib.content-gen/seo";
import { CodeBlock } from "@contractspec/lib.design-system";
import Link from "@contractspec/lib.ui-link";
import { ChevronRight } from "lucide-react";
import { jsx, jsxs } from "react/jsx-runtime";
var metadata = new SeoOptimizer().optimize(openapiAlternativeBrief);
function OpenapiAlternativePage() {
  return /* @__PURE__ */ jsxs("div", {
    className: "space-y-8",
    children: [
      /* @__PURE__ */ jsxs("div", {
        className: "space-y-3",
        children: [
          /* @__PURE__ */ jsx("h1", {
            className: "text-4xl font-bold",
            children: openapiAlternativeBrief.title
          }),
          /* @__PURE__ */ jsx("p", {
            className: "text-muted-foreground text-lg",
            children: openapiAlternativeBrief.summary
          })
        ]
      }),
      /* @__PURE__ */ jsxs("div", {
        className: "card-subtle space-y-4 p-6",
        children: [
          /* @__PURE__ */ jsx("h2", {
            className: "text-2xl font-bold",
            children: "OpenAPI Limitations"
          }),
          /* @__PURE__ */ jsx("ul", {
            className: "text-muted-foreground space-y-2 text-sm",
            children: openapiAlternativeBrief.problems.map((problem, index) => /* @__PURE__ */ jsx("li", {
              children: problem
            }, index))
          })
        ]
      }),
      /* @__PURE__ */ jsxs("div", {
        className: "card-subtle space-y-4 p-6",
        children: [
          /* @__PURE__ */ jsx("h2", {
            className: "text-2xl font-bold",
            children: "ContractSpec Advantages"
          }),
          /* @__PURE__ */ jsx("ul", {
            className: "text-muted-foreground space-y-2 text-sm",
            children: openapiAlternativeBrief.solutions.map((solution, index) => /* @__PURE__ */ jsx("li", {
              children: solution
            }, index))
          })
        ]
      }),
      /* @__PURE__ */ jsxs("div", {
        className: "space-y-6",
        children: [
          /* @__PURE__ */ jsxs("div", {
            className: "space-y-3",
            children: [
              /* @__PURE__ */ jsx("h2", {
                className: "text-2xl font-bold",
                children: "Comparison: OpenAPI vs ContractSpec"
              }),
              /* @__PURE__ */ jsx("p", {
                className: "text-muted-foreground text-sm",
                children: "Key differences between OpenAPI documentation and ContractSpec executable contracts."
              }),
              /* @__PURE__ */ jsxs("div", {
                className: "grid gap-6 md:grid-cols-2",
                children: [
                  /* @__PURE__ */ jsxs("div", {
                    className: "card-subtle space-y-3 p-4",
                    children: [
                      /* @__PURE__ */ jsx("h3", {
                        className: "text-lg font-semibold",
                        children: "OpenAPI"
                      }),
                      /* @__PURE__ */ jsxs("ul", {
                        className: "text-muted-foreground space-y-1 text-sm",
                        children: [
                          /* @__PURE__ */ jsx("li", {
                            children: "\u2022 Documentation specification only"
                          }),
                          /* @__PURE__ */ jsx("li", {
                            children: "\u2022 No runtime validation"
                          }),
                          /* @__PURE__ */ jsx("li", {
                            children: "\u2022 Manual code generation"
                          }),
                          /* @__PURE__ */ jsx("li", {
                            children: "\u2022 Type safety requires tools"
                          }),
                          /* @__PURE__ */ jsx("li", {
                            children: "\u2022 Separate schemas from documentation"
                          })
                        ]
                      })
                    ]
                  }),
                  /* @__PURE__ */ jsxs("div", {
                    className: "card-subtle space-y-3 p-4",
                    children: [
                      /* @__PURE__ */ jsx("h3", {
                        className: "text-lg font-semibold",
                        children: "ContractSpec"
                      }),
                      /* @__PURE__ */ jsxs("ul", {
                        className: "text-muted-foreground space-y-1 text-sm",
                        children: [
                          /* @__PURE__ */ jsx("li", {
                            children: "\u2022 Executable contracts"
                          }),
                          /* @__PURE__ */ jsx("li", {
                            children: "\u2022 Built-in runtime validation"
                          }),
                          /* @__PURE__ */ jsx("li", {
                            children: "\u2022 Automatic code generation"
                          }),
                          /* @__PURE__ */ jsx("li", {
                            children: "\u2022 Type-safe by default"
                          }),
                          /* @__PURE__ */ jsx("li", {
                            children: "\u2022 Unified spec and implementation"
                          })
                        ]
                      })
                    ]
                  })
                ]
              })
            ]
          }),
          /* @__PURE__ */ jsxs("div", {
            className: "space-y-3",
            children: [
              /* @__PURE__ */ jsx("h2", {
                className: "text-2xl font-bold",
                children: "Export from Contracts"
              }),
              /* @__PURE__ */ jsx("p", {
                className: "text-muted-foreground text-sm",
                children: "Generate OpenAPI documentation from ContractSpec for existing tooling."
              }),
              /* @__PURE__ */ jsx(CodeBlock, {
                language: "bash",
                filename: "export-openapi",
                code: `# From ContractSpec contracts
contractspec openapi export \\
  --registry ./src/contracts/registry.ts \\
  --format yaml \\
  --out ./openapi.yaml

# Compare: Manual OpenAPI vs Generated
# Manual: Write OpenAPI by hand, maintain separately
# Generated: Single source of truth, always in sync`
              })
            ]
          }),
          /* @__PURE__ */ jsxs("div", {
            className: "space-y-3",
            children: [
              /* @__PURE__ */ jsx("h2", {
                className: "text-2xl font-bold",
                children: "Beyond Documentation"
              }),
              /* @__PURE__ */ jsx("p", {
                className: "text-muted-foreground text-sm",
                children: "ContractSpec provides more than just API documentation."
              }),
              /* @__PURE__ */ jsx(CodeBlock, {
                language: "typescript",
                filename: "multi-output-example.ts",
                code: `// One contract, multiple outputs
import { UserApiContract } from './contracts/user-api.contract';

// Generated outputs
export const outputs = {
  // API documentation (OpenAPI)
  openapi: UserApiContract.toOpenAPI(),
  
  // Client SDKs (TypeScript, Python, etc.)
  clients: UserApiContract.generateClients({
    languages: ['typescript', 'python', 'go'],
  }),
  
  // Database schemas (Prisma, Drizzle)
  database: UserApiContract.toDatabase({
    adapter: 'prisma',
  }),
  
  // API handlers (Express, Fastify, Next.js)
  handlers: UserApiContract.toHandlers({
    framework: 'express',
  }),
  
  // Validation middleware
  validation: UserApiContract.toValidation({
    library: 'zod',
  }),
  
  // Type definitions
  types: UserApiContract.toTypescript(),
};`
              })
            ]
          })
        ]
      }),
      /* @__PURE__ */ jsxs("div", {
        className: "flex items-center gap-4 pt-4",
        children: [
          /* @__PURE__ */ jsxs(Link, {
            href: "/docs/guides/generate-docs-clients-schemas",
            className: "btn-primary",
            children: [
              "Generate from Contracts ",
              /* @__PURE__ */ jsx(ChevronRight, {
                size: 16
              })
            ]
          }),
          /* @__PURE__ */ jsx(Link, {
            href: "/docs/intent/generate-client-from-schema",
            className: "btn-ghost",
            children: "Client Generation"
          })
        ]
      })
    ]
  });
}
export {
  metadata,
  OpenapiAlternativePage
};
