// @bun
// src/presentation/features/organisms/FeatureDetail/FeatureDetail.tsx
import {
  StatCard,
  StatCardGroup,
  StatusChip
} from "@contractspec/lib.design-system";
import { Box, HStack, VStack } from "@contractspec/lib.ui-kit-web/ui/stack";
import { cn } from "@contractspec/lib.ui-kit-web/ui/utils";
import Link from "next/link";
import { jsx, jsxs } from "react/jsx-runtime";
"use client";
var stabilityTone = {
  stable: "success",
  beta: "warning",
  experimental: "info",
  deprecated: "danger"
};
function FeatureDetail({ feature, className }) {
  const { meta, operations, events, presentations, capabilities } = feature;
  const tone = stabilityTone[meta.stability] ?? "neutral";
  return /* @__PURE__ */ jsxs(VStack, {
    gap: "lg",
    className: cn("w-full", className),
    children: [
      /* @__PURE__ */ jsxs(HStack, {
        gap: "sm",
        children: [
          /* @__PURE__ */ jsx(StatusChip, {
            tone,
            label: meta.stability ?? "unknown"
          }),
          /* @__PURE__ */ jsx(StatusChip, {
            tone: "neutral",
            label: meta.key,
            size: "sm"
          }),
          /* @__PURE__ */ jsx(StatusChip, {
            tone: "neutral",
            label: `v${meta.version}`,
            size: "sm"
          })
        ]
      }),
      /* @__PURE__ */ jsxs(StatCardGroup, {
        children: [
          /* @__PURE__ */ jsx(Link, {
            href: `./${feature.meta.key}/operations`,
            children: /* @__PURE__ */ jsx(StatCard, {
              label: "Operations",
              value: operations?.length ?? 0
            })
          }),
          /* @__PURE__ */ jsx(Link, {
            href: `./${feature.meta.key}/events`,
            children: /* @__PURE__ */ jsx(StatCard, {
              label: "Events",
              value: events?.length ?? 0
            })
          }),
          /* @__PURE__ */ jsx(Link, {
            href: `./${feature.meta.key}/presentations`,
            children: /* @__PURE__ */ jsx(StatCard, {
              label: "Presentations",
              value: presentations?.length ?? 0
            })
          })
        ]
      }),
      capabilities?.provides?.length ? /* @__PURE__ */ jsxs(Box, {
        className: "flex-col rounded-lg border p-4",
        gap: "sm",
        align: "start",
        children: [
          /* @__PURE__ */ jsx("span", {
            className: "font-semibold",
            children: "Provides Capabilities"
          }),
          /* @__PURE__ */ jsx(HStack, {
            gap: "xs",
            wrap: "wrap",
            children: capabilities.provides.map((cap) => /* @__PURE__ */ jsx(StatusChip, {
              tone: "success",
              label: `${cap.key} v${cap.version}`,
              size: "sm"
            }, `${cap.key}-${cap.version}`))
          })
        ]
      }) : null,
      capabilities?.requires?.length ? /* @__PURE__ */ jsxs(Box, {
        className: "flex-col rounded-lg border p-4",
        gap: "sm",
        align: "start",
        children: [
          /* @__PURE__ */ jsx("span", {
            className: "font-semibold",
            children: "Requires Capabilities"
          }),
          /* @__PURE__ */ jsx(HStack, {
            gap: "xs",
            wrap: "wrap",
            children: capabilities.requires.map((req) => /* @__PURE__ */ jsx(StatusChip, {
              tone: "info",
              label: `${req.key}${req.version ? ` v${req.version}` : ""}${req.optional ? " (optional)" : ""}`,
              size: "sm"
            }, req.key))
          })
        ]
      }) : null,
      meta.tags?.length ? /* @__PURE__ */ jsxs(Box, {
        className: "flex-col rounded-lg border p-4",
        gap: "sm",
        align: "start",
        children: [
          /* @__PURE__ */ jsx("span", {
            className: "font-semibold",
            children: "Tags"
          }),
          /* @__PURE__ */ jsx(HStack, {
            gap: "xs",
            wrap: "wrap",
            children: meta.tags.map((tag) => /* @__PURE__ */ jsx(StatusChip, {
              tone: "neutral",
              label: `#${tag}`,
              size: "sm"
            }, tag))
          })
        ]
      }) : null,
      meta.owners?.length ? /* @__PURE__ */ jsxs(Box, {
        className: "flex-col rounded-lg border p-4",
        gap: "sm",
        align: "start",
        children: [
          /* @__PURE__ */ jsx("span", {
            className: "font-semibold",
            children: "Owners"
          }),
          /* @__PURE__ */ jsx(HStack, {
            gap: "xs",
            wrap: "wrap",
            children: meta.owners.map((owner) => /* @__PURE__ */ jsx(StatusChip, {
              tone: "neutral",
              label: owner,
              size: "sm"
            }, owner))
          })
        ]
      }) : null
    ]
  });
}
// src/presentation/features/templates/FeatureOverviewTemplate/FeatureOverviewTemplate.tsx
import {
  PageHeaderResponsive,
  Breadcrumbs
} from "@contractspec/lib.design-system";
import { VStack as VStack2 } from "@contractspec/lib.ui-kit-web/ui/stack";
import { cn as cn2 } from "@contractspec/lib.ui-kit-web/ui/utils";
import { jsx as jsx2, jsxs as jsxs2 } from "react/jsx-runtime";
"use client";
function FeatureOverviewTemplate({
  feature,
  className
}) {
  return /* @__PURE__ */ jsxs2(VStack2, {
    gap: "lg",
    className: cn2("mx-auto w-full max-w-5xl p-6", className),
    children: [
      /* @__PURE__ */ jsx2(PageHeaderResponsive, {
        title: feature.meta.title || feature.meta.key,
        subtitle: feature.meta.description || "Feature overview",
        breadcrumb: /* @__PURE__ */ jsx2(Breadcrumbs, {
          items: [
            { label: "Features", href: "/features" },
            { label: feature.meta.title || feature.meta.key }
          ]
        })
      }),
      /* @__PURE__ */ jsx2(FeatureDetail, {
        feature
      })
    ]
  });
}
export {
  FeatureOverviewTemplate
};
