import { Building2 } from "lucide-react"; import { cn } from "@/lib/utils"; import { Badge } from "@/components/ui/badge"; import { Accordion, AccordionContent, AccordionItem, AccordionTrigger, } from "@/components/ui/accordion"; import { formatCurrency } from "@/lib/format-currency"; // ─── Types ──────────────────────────────────────────────────────────────────── export type PropertyMortgage = { id: string; /** Display label e.g. "Mortgage" */ label: string; /** Loan type shown as a badge e.g. "Home Loan", "Investment Loan" */ type: string; /** Monthly repayment shown in the accordion header */ monthlyRepayment: number; /** Outstanding loan balance */ loanAmount: number; /** Monthly repayment shown in Loan Details */ repaymentAmount: number; /** Annual interest rate (%) */ interestRate: number; }; export type PropertyAssetCardProps = { /** Full property address */ address: string; /** Asset category label shown below the address */ assetType?: string; /** URL for the lending institution's logo — falls back to a building icon */ institutionLogoUrl?: string; /** Current estimated market value */ estimatedValue: number; /** Loan-to-value ratio (0–100) */ lvr?: number; /** Net equity in dollars (estimatedValue − totalOwing) */ netEquity?: number; /** Linked mortgage records */ mortgages?: PropertyMortgage[]; className?: string; }; // ─── Constants ──────────────────────────────────────────────────────────────── const EMPTY_MORTGAGES: PropertyMortgage[] = []; // ─── Component ──────────────────────────────────────────────────────────────── /** * PropertyAssetCard — summary card for a single property asset in the loan * wizard Assets tab. * * Shows: institution logo, address, estimated value, interest rate + LVR stats, * net equity highlight, and an expandable mortgage accordion with Loan Details * and Property Statistics sub-sections. * * Figma: WealthX-Backoffice---Mobile-App — node 17418:41358 */ export function PropertyAssetCard({ address, assetType = "Property", institutionLogoUrl, estimatedValue, lvr, netEquity, mortgages = EMPTY_MORTGAGES, className, }: PropertyAssetCardProps) { const primaryRate = mortgages[0]?.interestRate; return (