'use client'; import { Card, CardContent, CardDescription, CardHeader, CardTitle } from '@/components/ui/card'; import type { ValuationResult } from '@/lib/valuation-api'; interface ValuationResultsProps { result: ValuationResult; } function formatPrice(num: number): string { if (num >= 1_000_000_000) return `${(num / 1_000_000_000).toFixed(2)} ty`; if (num >= 1_000_000) return `${(num / 1_000_000).toFixed(0)} trieu`; return num.toLocaleString('vi-VN'); } function formatPriceM2(price: number): string { if (price >= 1_000_000) return `${(price / 1_000_000).toFixed(1)} tr/m2`; return `${price.toLocaleString('vi-VN')} d/m2`; } export function ValuationResults({ result }: ValuationResultsProps) { const confidencePct = Math.round(result.confidence * 100); return (
{/* Main estimate */} Gia uoc tinh boi AI {formatPrice(result.estimatedPriceVND)} VND

Do tin cay

{confidencePct}%

Gia/m2

{formatPriceM2(result.pricePerM2)}

Khoang gia

{formatPrice(result.priceRangeLow)} - {formatPrice(result.priceRangeHigh)}

{/* Price drivers */} {result.priceDrivers.length > 0 && ( Yeu to anh huong gia Cac yeu to chinh tac dong den gia tri bat dong san
{result.priceDrivers.map((driver) => (
{driver.direction === 'positive' ? '+' : '-'} {Math.abs(driver.impact).toFixed(1)}%
{driver.feature}
))}
)} {/* Comparables */} {result.comparables.length > 0 && ( Bat dong san tuong tu {result.comparables.length} bat dong san co dac diem tuong tu trong khu vuc
{result.comparables.map((comp) => (

{comp.title}

{comp.district} · {comp.areaM2} m2

{formatPrice(Number(comp.priceVND))}

{formatPriceM2(comp.pricePerM2)}

{Math.round(comp.similarity * 100)}% tuong tu
))}
)}
); }