// @bun
// src/components/docs/libraries/LibrariesContractsPage.tsx
import Link from "@contractspec/lib.ui-link";
import { ChevronRight } from "lucide-react";
import { CodeBlock, InstallCommand } from "@contractspec/lib.design-system";
import { jsx, jsxs } from "react/jsx-runtime";
function LibrariesContractsPage() {
  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: "@contractspec/lib.contracts-spec"
          }),
          /* @__PURE__ */ jsx("p", {
            className: "text-muted-foreground text-lg",
            children: "The core library for defining what your application can do. Unified specifications for Operations, Events, Presentations, and Features."
          })
        ]
      }),
      /* @__PURE__ */ jsxs("div", {
        className: "space-y-4",
        children: [
          /* @__PURE__ */ jsx("h2", {
            className: "text-2xl font-bold",
            children: "Installation"
          }),
          /* @__PURE__ */ jsx(InstallCommand, {
            package: [
              "@contractspec/lib.contracts-spec",
              "@contractspec/lib.schema"
            ]
          })
        ]
      }),
      /* @__PURE__ */ jsxs("div", {
        className: "space-y-4",
        children: [
          /* @__PURE__ */ jsx("h2", {
            className: "text-2xl font-bold",
            children: "What lives where"
          }),
          /* @__PURE__ */ jsxs("ul", {
            className: "text-muted-foreground list-inside list-disc space-y-2",
            children: [
              /* @__PURE__ */ jsxs("li", {
                children: [
                  /* @__PURE__ */ jsx("strong", {
                    children: "@contractspec/lib.contracts-spec"
                  }),
                  " (root): The core contracts definitions (OperationSpec, PresentationSpec, Registry)."
                ]
              }),
              /* @__PURE__ */ jsxs("li", {
                children: [
                  /* @__PURE__ */ jsx("strong", {
                    children: "@contractspec/lib.contracts-runtime-client-react"
                  }),
                  ": Browser-safe helpers (React renderers, client SDK). Import this for web/React Native."
                ]
              }),
              /* @__PURE__ */ jsxs("li", {
                children: [
                  /* @__PURE__ */ jsx("strong", {
                    children: "@contractspec/lib.contracts-runtime-server-rest"
                  }),
                  ": HTTP/MCP adapters, registries, integrations (Node-only)."
                ]
              }),
              /* @__PURE__ */ jsxs("li", {
                children: [
                  /* @__PURE__ */ jsx("strong", {
                    children: "@contractspec/lib.schema"
                  }),
                  ": Schema dictionary (SchemaModel, FieldType) for I/O definitions."
                ]
              })
            ]
          })
        ]
      }),
      /* @__PURE__ */ jsxs("div", {
        className: "space-y-4",
        children: [
          /* @__PURE__ */ jsx("h2", {
            className: "text-2xl font-bold",
            children: "Quick Example"
          }),
          /* @__PURE__ */ jsx(CodeBlock, {
            language: "typescript",
            code: `import { defineCommand } from '@contractspec/lib.contracts-spec';
import { SchemaModel, ScalarTypeEnum } from '@contractspec/lib.schema';

const CreateUserInput = new SchemaModel({
  name: 'CreateUserInput',
  fields: {
    email: { type: ScalarTypeEnum.Email(), isOptional: false },
    name: { type: ScalarTypeEnum.NonEmptyString(), isOptional: false },
  },
});

export const CreateUser = defineCommand({
  meta: {
    key: 'users.createUser',
    version: '1.0.0',
    description: 'Create a new user account',
  },
  io: {
    input: CreateUserInput,
    output: /* ... */,
  },
  policy: { auth: 'admin' },
});`
          })
        ]
      }),
      /* @__PURE__ */ jsxs("div", {
        className: "space-y-4",
        children: [
          /* @__PURE__ */ jsx("h2", {
            className: "text-2xl font-bold",
            children: "Core Concepts"
          }),
          /* @__PURE__ */ jsxs("ul", {
            className: "text-muted-foreground list-inside list-disc space-y-2",
            children: [
              /* @__PURE__ */ jsxs("li", {
                children: [
                  /* @__PURE__ */ jsx("strong", {
                    children: "OperationSpec"
                  }),
                  ": Immutable description of an operation (Command or Query). Defines I/O, policy, and metadata."
                ]
              }),
              /* @__PURE__ */ jsxs("li", {
                children: [
                  /* @__PURE__ */ jsx("strong", {
                    children: "OperationSpecRegistry"
                  }),
                  ": Registry of specs + handlers. Use ",
                  /* @__PURE__ */ jsx("code", {
                    className: "font-mono text-xs",
                    children: "installOp"
                  }),
                  " ",
                  "to attach a handler."
                ]
              }),
              /* @__PURE__ */ jsxs("li", {
                children: [
                  /* @__PURE__ */ jsx("strong", {
                    children: "CapabilitySpec"
                  }),
                  ": Canonical capability declaration (requires/provides)."
                ]
              }),
              /* @__PURE__ */ jsxs("li", {
                children: [
                  /* @__PURE__ */ jsx("strong", {
                    children: "PolicySpec"
                  }),
                  ": Declarative policy rules (ABAC/ReBAC, rate limits)."
                ]
              }),
              /* @__PURE__ */ jsxs("li", {
                children: [
                  /* @__PURE__ */ jsx("strong", {
                    children: "TelemetrySpec"
                  }),
                  ": Analytics definitions and privacy levels."
                ]
              }),
              /* @__PURE__ */ jsxs("li", {
                children: [
                  /* @__PURE__ */ jsx("strong", {
                    children: "PresentationSpec (V2)"
                  }),
                  ": Describes how data is rendered (Web Components, Markdown, Data)."
                ]
              })
            ]
          })
        ]
      }),
      /* @__PURE__ */ jsxs("div", {
        className: "space-y-4",
        children: [
          /* @__PURE__ */ jsx("h2", {
            className: "text-2xl font-bold",
            children: "Lifecycle"
          }),
          /* @__PURE__ */ jsxs("ol", {
            className: "text-muted-foreground list-inside list-decimal space-y-2",
            children: [
              /* @__PURE__ */ jsxs("li", {
                children: [
                  /* @__PURE__ */ jsx("strong", {
                    children: "Define"
                  }),
                  " the spec (I/O via SchemaModel or Zod)."
                ]
              }),
              /* @__PURE__ */ jsxs("li", {
                children: [
                  /* @__PURE__ */ jsx("strong", {
                    children: "Register"
                  }),
                  " it:",
                  " ",
                  /* @__PURE__ */ jsx("code", {
                    className: "font-mono text-xs",
                    children: "installOp(registry, spec, handler)"
                  }),
                  "."
                ]
              }),
              /* @__PURE__ */ jsxs("li", {
                children: [
                  /* @__PURE__ */ jsx("strong", {
                    children: "Expose"
                  }),
                  " it via an adapter (REST, GraphQL, MCP)."
                ]
              }),
              /* @__PURE__ */ jsxs("li", {
                children: [
                  /* @__PURE__ */ jsx("strong", {
                    children: "Validate"
                  }),
                  " at runtime automatically."
                ]
              })
            ]
          })
        ]
      }),
      /* @__PURE__ */ jsxs("div", {
        className: "space-y-4",
        children: [
          /* @__PURE__ */ jsx("h2", {
            className: "text-2xl font-bold",
            children: "Adapters"
          }),
          /* @__PURE__ */ jsxs("ul", {
            className: "text-muted-foreground space-y-2",
            children: [
              /* @__PURE__ */ jsxs("li", {
                children: [
                  /* @__PURE__ */ jsx("code", {
                    className: "bg-background/50 rounded px-2 py-1",
                    children: "server/rest-next-app"
                  }),
                  ": Next.js App Router adapter"
                ]
              }),
              /* @__PURE__ */ jsxs("li", {
                children: [
                  /* @__PURE__ */ jsx("code", {
                    className: "bg-background/50 rounded px-2 py-1",
                    children: "server/provider-mcp"
                  }),
                  ": Model Context Protocol (MCP) for AI agents"
                ]
              }),
              /* @__PURE__ */ jsxs("li", {
                children: [
                  /* @__PURE__ */ jsx("code", {
                    className: "bg-background/50 rounded px-2 py-1",
                    children: "server/graphql-pothos"
                  }),
                  ": GraphQL schema generator"
                ]
              })
            ]
          })
        ]
      }),
      /* @__PURE__ */ jsxs("div", {
        className: "flex items-center gap-4 pt-4",
        children: [
          /* @__PURE__ */ jsxs(Link, {
            href: "/docs/libraries/schema",
            className: "btn-primary",
            children: [
              "Next: Schema ",
              /* @__PURE__ */ jsx(ChevronRight, {
                size: 16
              })
            ]
          }),
          /* @__PURE__ */ jsx(Link, {
            href: "/docs/specs/capabilities",
            className: "btn-ghost",
            children: "Core Concepts"
          })
        ]
      })
    ]
  });
}
export {
  LibrariesContractsPage
};
