// src/components/docs/specs/SpecsCapabilitiesPage.tsx
import Link from "@contractspec/lib.ui-link";
import { ChevronRight } from "lucide-react";
import { jsx, jsxs } from "react/jsx-runtime";
function SpecsCapabilitiesPage() {
  return /* @__PURE__ */ jsxs("div", {
    className: "space-y-8",
    children: [
      /* @__PURE__ */ jsxs("div", {
        className: "space-y-2",
        children: [
          /* @__PURE__ */ jsx("h1", {
            className: "text-4xl font-bold",
            children: "Capabilities"
          }),
          /* @__PURE__ */ jsx("p", {
            className: "text-muted-foreground text-lg",
            children: "Capabilities are the core building block of ContractSpec. They define what your app can do."
          })
        ]
      }),
      /* @__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: "Overview"
              }),
              /* @__PURE__ */ jsx("p", {
                className: "text-muted-foreground",
                children: "A ContractSpec (or Capability) is a typed, declarative description of an operation. It defines the operation's name, version, inputs, outputs, policies, and side effects. Runtime adapters automatically serve these as REST/GraphQL/MCP endpoints with full validation and policy enforcement."
              })
            ]
          }),
          /* @__PURE__ */ jsxs("div", {
            className: "space-y-3",
            children: [
              /* @__PURE__ */ jsx("h2", {
                className: "text-2xl font-bold",
                children: "Defining a Command (Write)"
              }),
              /* @__PURE__ */ jsx("div", {
                className: "bg-background/50 border-border text-muted-foreground overflow-x-auto rounded-lg border p-4 font-mono text-sm",
                children: /* @__PURE__ */ jsx("pre", {
                  children: `import { defineCommand } from '@contractspec/lib.contracts-spec';
import { SchemaModel, ScalarTypeEnum } from '@contractspec/lib.schema';

const TransferFundsInput = new SchemaModel({
  name: 'TransferFundsInput',
  fields: {
    recipient: { type: ScalarTypeEnum.NonEmptyString(), isOptional: false },
    amount: { type: ScalarTypeEnum.PositiveNumber(), isOptional: false },
  },
});

const TransferFundsOutput = new SchemaModel({
  name: 'TransferFundsOutput',
  fields: {
    transactionId: { type: ScalarTypeEnum.String(), isOptional: false },
    timestamp: { type: ScalarTypeEnum.DateTime(), isOptional: false },
  },
});

export const TransferFunds = defineCommand({
  meta: {
    key: 'wallet.transferFunds',
    version: '1.0.0',
    description: 'Transfer funds to another user',
    goal: 'Enable peer-to-peer payments',
    context: 'Requires sufficient balance',
    owners: ['team-payments'],
    tags: ['payments'],
    stability: 'stable',
  },
  io: {
    input: TransferFundsInput,
    output: TransferFundsOutput,
  },
  policy: {
    auth: 'user',
    flags: ['payments_enabled'],
  },
});`
                })
              })
            ]
          }),
          /* @__PURE__ */ jsxs("div", {
            className: "space-y-3",
            children: [
              /* @__PURE__ */ jsx("h2", {
                className: "text-2xl font-bold",
                children: "Schema Types"
              }),
              /* @__PURE__ */ jsxs("p", {
                className: "text-muted-foreground",
                children: [
                  "ContractSpec uses ",
                  /* @__PURE__ */ jsx("code", {
                    children: "@contractspec/lib.schema"
                  }),
                  " for I/O definitions. This provides Zod validation, GraphQL types, and JSON Schema from a single source."
                ]
              }),
              /* @__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: "ScalarTypeEnum.NonEmptyString()"
                      }),
                      " ",
                      "- Non-empty text"
                    ]
                  }),
                  /* @__PURE__ */ jsxs("li", {
                    children: [
                      "•",
                      " ",
                      /* @__PURE__ */ jsx("code", {
                        className: "bg-background/50 rounded px-2 py-1",
                        children: "ScalarTypeEnum.PositiveNumber()"
                      }),
                      " ",
                      "- Positive numbers"
                    ]
                  }),
                  /* @__PURE__ */ jsxs("li", {
                    children: [
                      "•",
                      " ",
                      /* @__PURE__ */ jsx("code", {
                        className: "bg-background/50 rounded px-2 py-1",
                        children: "ScalarTypeEnum.DateTime()"
                      }),
                      " ",
                      "- ISO 8601 timestamps"
                    ]
                  }),
                  /* @__PURE__ */ jsxs("li", {
                    children: [
                      "•",
                      " ",
                      /* @__PURE__ */ jsx("code", {
                        className: "bg-background/50 rounded px-2 py-1",
                        children: "ScalarTypeEnum.Email()"
                      }),
                      " ",
                      "- Valid email addresses"
                    ]
                  }),
                  /* @__PURE__ */ jsxs("li", {
                    children: [
                      "•",
                      " ",
                      /* @__PURE__ */ jsx("code", {
                        className: "bg-background/50 rounded px-2 py-1",
                        children: "defineEnum(...)"
                      }),
                      " ",
                      "- Type-safe enums"
                    ]
                  })
                ]
              })
            ]
          }),
          /* @__PURE__ */ jsx("div", {
            className: "flex items-center gap-4 pt-4",
            children: /* @__PURE__ */ jsxs(Link, {
              href: "/docs/specs/dataviews",
              className: "btn-primary",
              children: [
                "Next: DataViews ",
                /* @__PURE__ */ jsx(ChevronRight, {
                  size: 16
                })
              ]
            })
          })
        ]
      })
    ]
  });
}
export {
  SpecsCapabilitiesPage
};
