// src/components/docs/architecture/ArchitectureMultiTenancyPage.tsx
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";
function ArchitectureMultiTenancyPage() {
  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: "Multi-Tenancy"
          }),
          /* @__PURE__ */ jsx("p", {
            className: "text-muted-foreground",
            children: "ContractSpec is designed from the ground up for multi-tenancy. Apps built with ContractSpec can serve multiple organizations (tenants) from a single deployment, while ensuring strict data isolation and configuration separation."
          })
        ]
      }),
      /* @__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: "Tenant"
                  }),
                  ": An organization or customer that uses your app. Each tenant has a unique ",
                  /* @__PURE__ */ jsx("code", {
                    children: "tenantId"
                  }),
                  "."
                ]
              }),
              /* @__PURE__ */ jsxs("li", {
                children: [
                  /* @__PURE__ */ jsx("strong", {
                    children: "Tenant Isolation"
                  }),
                  ": Data and configuration for one tenant is never accessible to another tenant unless explicitly shared."
                ]
              }),
              /* @__PURE__ */ jsxs("li", {
                children: [
                  /* @__PURE__ */ jsx("strong", {
                    children: "Tenant Context"
                  }),
                  ": Every request and operation runs within the context of a specific tenant."
                ]
              })
            ]
          })
        ]
      }),
      /* @__PURE__ */ jsxs("div", {
        className: "space-y-4",
        children: [
          /* @__PURE__ */ jsx("h2", {
            className: "text-2xl font-bold",
            children: "Tenant Resolution"
          }),
          /* @__PURE__ */ jsx("p", {
            className: "text-muted-foreground",
            children: "The runtime automatically resolves the tenant context for every request based on:"
          }),
          /* @__PURE__ */ jsxs("ul", {
            className: "text-muted-foreground list-inside list-disc space-y-2",
            children: [
              /* @__PURE__ */ jsxs("li", {
                children: [
                  "Subdomain (e.g., ",
                  /* @__PURE__ */ jsx("code", {
                    children: "acme.app.com"
                  }),
                  ")"
                ]
              }),
              /* @__PURE__ */ jsxs("li", {
                children: [
                  "Custom Domain (e.g., ",
                  /* @__PURE__ */ jsx("code", {
                    children: "portal.acme.com"
                  }),
                  ")"
                ]
              }),
              /* @__PURE__ */ jsxs("li", {
                children: [
                  "Header (e.g., ",
                  /* @__PURE__ */ jsx("code", {
                    children: "x-tenant-id: acme-corp"
                  }),
                  ")"
                ]
              }),
              /* @__PURE__ */ jsx("li", {
                children: "Authentication Token (embedded tenant claim)"
              })
            ]
          })
        ]
      }),
      /* @__PURE__ */ jsxs("div", {
        className: "space-y-4",
        children: [
          /* @__PURE__ */ jsx("h2", {
            className: "text-2xl font-bold",
            children: "Configuration Isolation"
          }),
          /* @__PURE__ */ jsxs("p", {
            className: "text-muted-foreground",
            children: [
              "Each tenant has its own ",
              /* @__PURE__ */ jsx("code", {
                children: "TenantAppConfig"
              }),
              " which defines:"
            ]
          }),
          /* @__PURE__ */ jsx(CodeBlock, {
            language: "typescript",
            code: `type TenantAppConfig = {
  tenantId: string;
  blueprintId: string;
  // ...
  integrationBindings: AppIntegrationBinding[];
  knowledgeBindings: AppKnowledgeBinding[];
  featureFlags: Record<string, boolean>;
};`
          }),
          /* @__PURE__ */ jsx("p", {
            className: "text-muted-foreground mt-2",
            children: "This allows you to customize feature flags, integration connections, and knowledge sources per tenant without changing the application code."
          })
        ]
      }),
      /* @__PURE__ */ jsxs("div", {
        className: "flex items-center gap-4 pt-4",
        children: [
          /* @__PURE__ */ jsx(Link, {
            href: "/docs/architecture",
            className: "btn-ghost",
            children: "Back to Architecture"
          }),
          /* @__PURE__ */ jsxs(Link, {
            href: "/docs/libraries/multi-tenancy",
            className: "btn-primary",
            children: [
              "Multi-Tenancy Library ",
              /* @__PURE__ */ jsx(ChevronRight, {
                size: 16
              })
            ]
          })
        ]
      })
    ]
  });
}
export {
  ArchitectureMultiTenancyPage
};
