import { Box, Chip, Paper, Typography } from '@mui/material' import { TrendingUp } from 'lucide-react' import { estimateMarketRent, type RentVerdict } from '../../lib/rentEstimate' import { DS_TEXT, DS_SURFACE, DS_BORDER } from '../../lib/ds' const VERDICT_META: Record = { BELOW: { label: 'Unter Markt', bg: DS_SURFACE.success.bg, border: DS_SURFACE.success.border, fg: DS_TEXT.success }, AT: { label: 'Marktkonform', bg: DS_SURFACE.blue.bg, border: DS_SURFACE.blue.border, fg: DS_TEXT.signalDark }, ABOVE: { label: 'Über Markt', bg: DS_SURFACE.warning.bg, border: DS_SURFACE.warning.border, fg: DS_TEXT.warning }, } interface Props { city: string assetType: string askingRentPerSqm: number futureRentPerSqm?: number // Pre-Market: erwarteter künftiger Preis } function chf(v: number): string { return `CHF ${Math.round(v).toLocaleString('de-CH')}/m²` } export function MarketPricePanel({ city, assetType, askingRentPerSqm, futureRentPerSqm }: Props) { const est = estimateMarketRent(city, assetType, askingRentPerSqm) if (!est) return null const meta = VERDICT_META[est.verdict] return ( Marktpreis-Einschätzung Angebotsmiete {chf(est.askingRentPerSqm)} Faire Marktmiete {chf(est.fairRentPerSqm)} {est.deltaPct > 0 ? `+${est.deltaPct}%` : `${est.deltaPct}%`} {futureRentPerSqm != null && futureRentPerSqm > 0 && ( Erwartet (Pre-Market) {chf(est.askingRentPerSqm)} {chf(futureRentPerSqm)} )} {est.rationale} ) }