// @bun
// src/components/docs/libraries/LibrariesSchemaPage.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 LibrariesSchemaPage() {
  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.schema"
          }),
          /* @__PURE__ */ jsx("p", {
            className: "text-muted-foreground",
            children: "A small schema dictionary to describe operation I/O once and export to Zod (runtime validation), Pothos (GraphQL type refs), and JSON Schema."
          })
        ]
      }),
      /* @__PURE__ */ jsxs("div", {
        className: "space-y-4",
        children: [
          /* @__PURE__ */ jsx("h2", {
            className: "text-2xl font-bold",
            children: "Installation"
          }),
          /* @__PURE__ */ jsx(InstallCommand, {
            package: "@contractspec/lib.schema"
          })
        ]
      }),
      /* @__PURE__ */ jsxs("div", {
        className: "space-y-4",
        children: [
          /* @__PURE__ */ jsx("h2", {
            className: "text-2xl font-bold",
            children: "Core Exports"
          }),
          /* @__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: "SchemaModel"
                  }),
                  ": Compose fields into typed object models"
                ]
              }),
              /* @__PURE__ */ jsxs("li", {
                children: [
                  /* @__PURE__ */ jsx("code", {
                    className: "bg-background/50 rounded px-2 py-1",
                    children: "ScalarTypeEnum"
                  }),
                  ": Common scalar types (NonEmptyString, Email, DateTime, etc.)"
                ]
              }),
              /* @__PURE__ */ jsxs("li", {
                children: [
                  /* @__PURE__ */ jsx("code", {
                    className: "bg-background/50 rounded px-2 py-1",
                    children: "defineEnum"
                  }),
                  ": Create type-safe enums"
                ]
              }),
              /* @__PURE__ */ jsxs("li", {
                children: [
                  /* @__PURE__ */ jsx("code", {
                    className: "bg-background/50 rounded px-2 py-1",
                    children: "FieldType"
                  }),
                  ": Wrap scalars with Zod/GraphQL/JSON Schema"
                ]
              })
            ]
          })
        ]
      }),
      /* @__PURE__ */ jsxs("div", {
        className: "space-y-4",
        children: [
          /* @__PURE__ */ jsx("h2", {
            className: "text-2xl font-bold",
            children: "Example: Basic Schema"
          }),
          /* @__PURE__ */ jsx(CodeBlock, {
            language: "typescript",
            code: `import { SchemaModel, ScalarTypeEnum } from '@contractspec/lib.schema';

export const CreateSpotInput = new SchemaModel({
  name: 'CreateSpotInput',
  fields: {
    name: { type: ScalarTypeEnum.NonEmptyString(), isOptional: false },
    latitude: { type: ScalarTypeEnum.Latitude(), isOptional: false },
    longitude: { type: ScalarTypeEnum.Longitude(), isOptional: false },
  },
});

// Get Zod schema for validation
const zodSchema = CreateSpotInput.getZod();

// Get Pothos input name for GraphQL
const pothosName = CreateSpotInput.getPothosInput();

// Get JSON Schema
const jsonSchema = CreateSpotInput.getJsonSchema();`
          })
        ]
      }),
      /* @__PURE__ */ jsxs("div", {
        className: "space-y-4",
        children: [
          /* @__PURE__ */ jsx("h2", {
            className: "text-2xl font-bold",
            children: "Example: Enums"
          }),
          /* @__PURE__ */ jsx(CodeBlock, {
            language: "typescript",
            code: `import { defineEnum, SchemaModel } from '@contractspec/lib.schema';

const Weekday = defineEnum('Weekday', [
  'MO', 'TU', 'WE', 'TH', 'FR', 'SA', 'SU',
] as const);

const RecurrenceRule = new SchemaModel({
  name: 'RecurrenceRule',
  fields: {
    frequency: {
      type: defineEnum('Frequency', ['DAILY', 'WEEKLY', 'MONTHLY'] as const),
      isOptional: false
    },
    byWeekday: { type: Weekday, isOptional: true, isArray: true },
  },
});`
          })
        ]
      }),
      /* @__PURE__ */ jsxs("div", {
        className: "space-y-4",
        children: [
          /* @__PURE__ */ jsx("h2", {
            className: "text-2xl font-bold",
            children: "Available Scalars"
          }),
          /* @__PURE__ */ jsxs("div", {
            className: "grid gap-4 md:grid-cols-2",
            children: [
              /* @__PURE__ */ jsxs("div", {
                className: "card-subtle p-4",
                children: [
                  /* @__PURE__ */ jsx("h3", {
                    className: "mb-2 font-semibold",
                    children: "Strings"
                  }),
                  /* @__PURE__ */ jsxs("ul", {
                    className: "text-muted-foreground space-y-1 text-sm",
                    children: [
                      /* @__PURE__ */ jsx("li", {
                        children: /* @__PURE__ */ jsx("code", {
                          children: "NonEmptyString()"
                        })
                      }),
                      /* @__PURE__ */ jsx("li", {
                        children: /* @__PURE__ */ jsx("code", {
                          children: "Email()"
                        })
                      }),
                      /* @__PURE__ */ jsx("li", {
                        children: /* @__PURE__ */ jsx("code", {
                          children: "PhoneNumber()"
                        })
                      }),
                      /* @__PURE__ */ jsx("li", {
                        children: /* @__PURE__ */ jsx("code", {
                          children: "CountryCode()"
                        })
                      }),
                      /* @__PURE__ */ jsx("li", {
                        children: /* @__PURE__ */ jsx("code", {
                          children: "Locale()"
                        })
                      }),
                      /* @__PURE__ */ jsx("li", {
                        children: /* @__PURE__ */ jsx("code", {
                          children: "TimeZone()"
                        })
                      })
                    ]
                  })
                ]
              }),
              /* @__PURE__ */ jsxs("div", {
                className: "card-subtle p-4",
                children: [
                  /* @__PURE__ */ jsx("h3", {
                    className: "mb-2 font-semibold",
                    children: "Numbers"
                  }),
                  /* @__PURE__ */ jsxs("ul", {
                    className: "text-muted-foreground space-y-1 text-sm",
                    children: [
                      /* @__PURE__ */ jsx("li", {
                        children: /* @__PURE__ */ jsx("code", {
                          children: "PositiveNumber()"
                        })
                      }),
                      /* @__PURE__ */ jsx("li", {
                        children: /* @__PURE__ */ jsx("code", {
                          children: "Latitude()"
                        })
                      }),
                      /* @__PURE__ */ jsx("li", {
                        children: /* @__PURE__ */ jsx("code", {
                          children: "Longitude()"
                        })
                      })
                    ]
                  })
                ]
              }),
              /* @__PURE__ */ jsxs("div", {
                className: "card-subtle p-4",
                children: [
                  /* @__PURE__ */ jsx("h3", {
                    className: "mb-2 font-semibold",
                    children: "Dates & Times"
                  }),
                  /* @__PURE__ */ jsxs("ul", {
                    className: "text-muted-foreground space-y-1 text-sm",
                    children: [
                      /* @__PURE__ */ jsx("li", {
                        children: /* @__PURE__ */ jsx("code", {
                          children: "Date()"
                        })
                      }),
                      /* @__PURE__ */ jsx("li", {
                        children: /* @__PURE__ */ jsx("code", {
                          children: "DateTime()"
                        })
                      })
                    ]
                  })
                ]
              }),
              /* @__PURE__ */ jsxs("div", {
                className: "card-subtle p-4",
                children: [
                  /* @__PURE__ */ jsx("h3", {
                    className: "mb-2 font-semibold",
                    children: "Generic"
                  }),
                  /* @__PURE__ */ jsxs("ul", {
                    className: "text-muted-foreground space-y-1 text-sm",
                    children: [
                      /* @__PURE__ */ jsx("li", {
                        children: /* @__PURE__ */ jsx("code", {
                          children: "String()"
                        })
                      }),
                      /* @__PURE__ */ jsx("li", {
                        children: /* @__PURE__ */ jsx("code", {
                          children: "JSON()"
                        })
                      })
                    ]
                  })
                ]
              })
            ]
          })
        ]
      }),
      /* @__PURE__ */ jsxs("div", {
        className: "flex items-center gap-4 pt-4",
        children: [
          /* @__PURE__ */ jsx(Link, {
            href: "/docs/libraries/contracts",
            className: "btn-ghost",
            children: "Previous: Contracts"
          }),
          /* @__PURE__ */ jsxs(Link, {
            href: "/docs/libraries/ui-kit",
            className: "btn-primary",
            children: [
              "Next: UI Kit ",
              /* @__PURE__ */ jsx(ChevronRight, {
                size: 16
              })
            ]
          })
        ]
      })
    ]
  });
}
export {
  LibrariesSchemaPage
};
