// @bun
// src/components/docs/intent/ContractFirstApiPage.tsx
import { contractFirstApiBrief } 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(contractFirstApiBrief);
function ContractFirstApiPage() {
  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: contractFirstApiBrief.title
          }),
          /* @__PURE__ */ jsx("p", {
            className: "text-muted-foreground text-lg",
            children: contractFirstApiBrief.summary
          })
        ]
      }),
      /* @__PURE__ */ jsxs("div", {
        className: "card-subtle space-y-4 p-6",
        children: [
          /* @__PURE__ */ jsx("h2", {
            className: "text-2xl font-bold",
            children: "Problems Solved"
          }),
          /* @__PURE__ */ jsx("ul", {
            className: "text-muted-foreground space-y-2 text-sm",
            children: contractFirstApiBrief.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: "Solutions"
          }),
          /* @__PURE__ */ jsx("ul", {
            className: "text-muted-foreground space-y-2 text-sm",
            children: contractFirstApiBrief.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: "Quick Start"
              }),
              /* @__PURE__ */ jsx("p", {
                className: "text-muted-foreground text-sm",
                children: "Define your first API contract and generate consistent implementations."
              }),
              /* @__PURE__ */ jsx(CodeBlock, {
                language: "typescript",
                filename: "src/contracts/user-create.operation.ts",
                code: `import { defineOperation } from '@contractspec/lib.contracts-spec/operations';
import { SchemaModel, ScalarTypeEnum } from '@contractspec/lib.schema';

export const CreateUserOperation = defineOperation({
  goal: 'Create a new user account with validation',
  context: 'Used by frontend registration forms and internal admin tools',
  input: new SchemaModel({
    type: 'object',
    properties: {
      email: {
        type: 'string',
        format: 'email',
        required: true,
      },
      password: {
        type: 'string',
        minLength: 8,
        required: true,
      },
    },
  }),
  output: new SchemaModel({
    type: 'object',
    properties: {
      id: { type: 'string', required: true },
      email: { type: 'string', required: true },
      createdAt: { type: 'string', format: 'date-time', required: true },
    },
  }),
  metadata: {
    name: 'createUser',
    tags: ['users', 'auth'],
    description: 'Create a new user account with email and password',
  },
});`
              })
            ]
          }),
          /* @__PURE__ */ jsxs("div", {
            className: "space-y-3",
            children: [
              /* @__PURE__ */ jsx("h2", {
                className: "text-2xl font-bold",
                children: "Generate OpenAPI"
              }),
              /* @__PURE__ */ jsx("p", {
                className: "text-muted-foreground text-sm",
                children: "Export OpenAPI documentation directly from your contracts."
              }),
              /* @__PURE__ */ jsx(CodeBlock, {
                language: "bash",
                filename: "export-openapi",
                code: `contractspec openapi export \\
  --registry ./src/contracts/registry.ts \\
  --out ./openapi.json`
              })
            ]
          })
        ]
      }),
      /* @__PURE__ */ jsxs("div", {
        className: "flex items-center gap-4 pt-4",
        children: [
          /* @__PURE__ */ jsxs(Link, {
            href: "/docs/guides/nextjs-one-endpoint",
            className: "btn-primary",
            children: [
              "Next.js Guide ",
              /* @__PURE__ */ jsx(ChevronRight, {
                size: 16
              })
            ]
          }),
          /* @__PURE__ */ jsx(Link, {
            href: "/docs/intent/spec-driven-development",
            className: "btn-ghost",
            children: "Spec-driven Development"
          })
        ]
      })
    ]
  });
}
export {
  metadata,
  ContractFirstApiPage
};
