{
  "$schema": "https://ui.shadcn.com/schema/registry-item.json",
  "name": "farm-sale-detail",
  "title": "Farm Sale Detail",
  "description": "Presentational dossier for a farm_sale listing (not a Farm operating entity, not a classified-with-extra-cards). Renders listing title/price/location plus the listing-owned cadastral overlay: erf/sg/lightstone seed refs, web_ref, cadastral_parcels (sg_key + area), land_uses breakdown, buildings and amenities, and an enquire CTA slot. Hosts wire the lead form via onEnquire or enquire; replace CadastralMap with a map when ready - v1 ships a parcel list only (no MapLibre, no PropData fetch).",
  "registryDependencies": [
    "badge",
    "button",
    "card",
    "separator",
    "table"
  ],
  "files": [
    {
      "path": "default/farm-sale-detail/listing-farm-sale-overlay.ts",
      "content": "import type { ReactNode } from \"react\"\n\nexport type ListingFarmSaleBuildingOrAmenity = {\n  name: string\n  kind?: string | null\n  notes?: string | null\n}\n\nexport type ListingFarmSaleCadastralParcel = {\n  id?: string\n  sg_key: string\n  area?: number | null\n  area_unit?: string | null\n}\n\nexport type ListingFarmSaleLandUse = {\n  id?: string\n  name: string\n  area?: number | null\n  area_unit?: string | null\n  notes?: string | null\n}\n\nexport type ListingFarmSaleOverlay = {\n  id?: string\n  erf_number?: string | null\n  sg_code?: string | null\n  lightstone_id?: string | null\n  propdata_id?: string | null\n  propdata_model?: \"residential\" | \"commercial\" | null\n  web_ref?: string | null\n  branch_id?: string | null\n  agent_id?: string | null\n  buildings?: ListingFarmSaleBuildingOrAmenity[] | null\n  amenities?: ListingFarmSaleBuildingOrAmenity[] | null\n  cadastral_parcels?: ListingFarmSaleCadastralParcel[]\n  land_uses?: ListingFarmSaleLandUse[]\n}\n\nexport type FarmSaleDetailProps = {\n  title: string\n  price?: string | null\n  location?: string | null\n  overlay?: ListingFarmSaleOverlay | null\n  onEnquire?: () => void\n  enquire?: ReactNode\n  cadastralMap?: ReactNode\n  className?: string\n}\n",
      "type": "registry:component"
    },
    {
      "path": "default/farm-sale-detail/cadastral-map.tsx",
      "content": "import type { ReactNode } from \"react\"\n\nimport { Card, CardContent, CardDescription, CardHeader, CardTitle } from \"@/components/ui/card\"\n\nexport type CadastralMapProps = {\n  className?: string\n  children?: ReactNode\n}\n\nexport function CadastralMap({ className, children }: CadastralMapProps) {\n  if (children) {\n    return <div className={className}>{children}</div>\n  }\n\n  return (\n    <Card className={className} data-slot=\"cadastral-map-placeholder\">\n      <CardHeader>\n        <CardTitle>Cadastral map</CardTitle>\n        <CardDescription>\n          MapLibre is not embedded in v1. Pass a `cadastralMap` slot to replace this\n          placeholder, or render parcels from the overlay list below.\n        </CardDescription>\n      </CardHeader>\n      <CardContent />\n    </Card>\n  )\n}\n",
      "type": "registry:component"
    },
    {
      "path": "default/farm-sale-detail/farm-sale-detail.tsx",
      "content": "\"use client\"\n\nimport { Badge } from \"@/components/ui/badge\"\nimport { Button } from \"@/components/ui/button\"\nimport {\n  Card,\n  CardContent,\n  CardDescription,\n  CardHeader,\n  CardTitle,\n} from \"@/components/ui/card\"\nimport { Separator } from \"@/components/ui/separator\"\nimport {\n  Table,\n  TableBody,\n  TableCell,\n  TableHead,\n  TableHeader,\n  TableRow,\n} from \"@/components/ui/table\"\n\nimport { CadastralMap } from \"@/registry/default/farm-sale-detail/cadastral-map\"\nimport type {\n  FarmSaleDetailProps,\n  ListingFarmSaleBuildingOrAmenity,\n} from \"@/registry/default/farm-sale-detail/listing-farm-sale-overlay\"\n\nfunction formatArea(area?: number | null, areaUnit?: string | null) {\n  if (area == null) return \"N/A\"\n  return areaUnit ? `${area} ${areaUnit}` : String(area)\n}\n\nfunction NamedNotesList({\n  title,\n  items,\n}: {\n  title: string\n  items: ListingFarmSaleBuildingOrAmenity[]\n}) {\n  if (items.length === 0) return null\n\n  return (\n    <Card>\n      <CardHeader>\n        <CardTitle>{title}</CardTitle>\n      </CardHeader>\n      <CardContent>\n        <ul className=\"flex flex-col gap-3\">\n          {items.map((item, index) => (\n            <li\n              key={`${item.name}-${index}`}\n              className=\"flex flex-col gap-1\"\n              data-slot={title.toLowerCase()}\n            >\n              <div className=\"flex flex-wrap items-center gap-2\">\n                <span className=\"font-medium\">{item.name}</span>\n                {item.kind ? <Badge variant=\"secondary\">{item.kind}</Badge> : null}\n              </div>\n              {item.notes ? (\n                <p className=\"text-sm text-muted-foreground\">{item.notes}</p>\n              ) : null}\n            </li>\n          ))}\n        </ul>\n      </CardContent>\n    </Card>\n  )\n}\n\nexport function FarmSaleDetail({\n  title,\n  price,\n  location,\n  overlay,\n  onEnquire,\n  enquire,\n  cadastralMap,\n  className,\n}: FarmSaleDetailProps) {\n  const parcels = overlay?.cadastral_parcels ?? []\n  const landUses = overlay?.land_uses ?? []\n  const buildings = overlay?.buildings ?? []\n  const amenities = overlay?.amenities ?? []\n\n  const seedRefs = [\n    overlay?.erf_number ? { label: \"Erf\", value: overlay.erf_number } : null,\n    overlay?.sg_code ? { label: \"SG\", value: overlay.sg_code } : null,\n    overlay?.lightstone_id\n      ? { label: \"Lightstone\", value: overlay.lightstone_id }\n      : null,\n    overlay?.web_ref ? { label: \"Web ref\", value: overlay.web_ref } : null,\n  ].filter(Boolean) as { label: string; value: string }[]\n\n  const enquireControl =\n    enquire ??\n    (onEnquire ? (\n      <Button type=\"button\" onClick={onEnquire}>\n        Enquire\n      </Button>\n    ) : null)\n\n  return (\n    <div className={[\"flex flex-col gap-6\", className].filter(Boolean).join(\" \")}>\n      <Card>\n        <CardHeader className=\"flex flex-col gap-4 sm:flex-row sm:items-start sm:justify-between\">\n          <div className=\"flex flex-col gap-2\">\n            <CardTitle>{title}</CardTitle>\n            {location ? <CardDescription>{location}</CardDescription> : null}\n            {price ? (\n              <p className=\"text-2xl font-semibold tracking-tight\">{price}</p>\n            ) : null}\n          </div>\n          {enquireControl}\n        </CardHeader>\n        {seedRefs.length > 0 ? (\n          <>\n            <Separator />\n            <CardContent className=\"flex flex-wrap gap-2 pt-6\">\n              {seedRefs.map((ref) => (\n                <Badge key={ref.label} variant=\"outline\">\n                  {ref.label}: {ref.value}\n                </Badge>\n              ))}\n            </CardContent>\n          </>\n        ) : null}\n      </Card>\n\n      <CadastralMap>{cadastralMap}</CadastralMap>\n\n      <Card>\n        <CardHeader>\n          <CardTitle>Cadastral parcels</CardTitle>\n          <CardDescription>Survey-general keys and areas from the listing overlay.</CardDescription>\n        </CardHeader>\n        <CardContent>\n          {parcels.length === 0 ? (\n            <p className=\"text-sm text-muted-foreground\">No parcels on this listing.</p>\n          ) : (\n            <Table>\n              <TableHeader>\n                <TableRow>\n                  <TableHead>SG key</TableHead>\n                  <TableHead>Area</TableHead>\n                </TableRow>\n              </TableHeader>\n              <TableBody>\n                {parcels.map((parcel, index) => (\n                  <TableRow key={parcel.id ?? `${parcel.sg_key}-${index}`}>\n                    <TableCell>{parcel.sg_key}</TableCell>\n                    <TableCell>{formatArea(parcel.area, parcel.area_unit)}</TableCell>\n                  </TableRow>\n                ))}\n              </TableBody>\n            </Table>\n          )}\n        </CardContent>\n      </Card>\n\n      <Card>\n        <CardHeader>\n          <CardTitle>Land use</CardTitle>\n          <CardDescription>Area breakdown for the farm_sale listing.</CardDescription>\n        </CardHeader>\n        <CardContent>\n          {landUses.length === 0 ? (\n            <p className=\"text-sm text-muted-foreground\">No land-use rows on this listing.</p>\n          ) : (\n            <Table>\n              <TableHeader>\n                <TableRow>\n                  <TableHead>Name</TableHead>\n                  <TableHead>Area</TableHead>\n                  <TableHead>Notes</TableHead>\n                </TableRow>\n              </TableHeader>\n              <TableBody>\n                {landUses.map((landUse, index) => (\n                  <TableRow key={landUse.id ?? `${landUse.name}-${index}`}>\n                    <TableCell>{landUse.name}</TableCell>\n                    <TableCell>{formatArea(landUse.area, landUse.area_unit)}</TableCell>\n                    <TableCell>{landUse.notes ?? \"N/A\"}</TableCell>\n                  </TableRow>\n                ))}\n              </TableBody>\n            </Table>\n          )}\n        </CardContent>\n      </Card>\n\n      <NamedNotesList title=\"Buildings\" items={buildings} />\n      <NamedNotesList title=\"Amenities\" items={amenities} />\n    </div>\n  )\n}\n",
      "type": "registry:component"
    }
  ],
  "type": "registry:block"
}