import { Box, Chip, Typography } from '@mui/material' import { ShieldCheck } from 'lucide-react' import type { PropertyUnit } from '../../domain/property' // ── Property detail helpers ──────────────────────────────────────────────────── export const FLOOR_LABEL = (level: number) => level === 0 ? 'EG' : level < 0 ? `UG ${Math.abs(level)}` : `${level}.OG` export const ASSET_LABELS: Record = { OFFICE: 'Büro', LOGISTICS: 'Lager / Logistik', RETAIL: 'Retail / Laden', PRODUCTION: 'Produktion', MIXED: 'Gewerbe (gemischt)', } export const RISK_LABELS: Record = { LOW: 'Niedrig', MEDIUM: 'Mittel', HIGH: 'Hoch' } export const SOURCE_LABELS: Record = { ERP_IMPORT: 'ERP-Import (intern)', IMMOSCOUT_SCRAPE: 'ImmoScout24', HOMEGATE_SCRAPE: 'Homegate', MATCHOFFICE_SCRAPE: 'MatchOffice', NEWHOME_SCRAPE: 'newhome.ch', AI_SIGNAL: 'KI-Signal', MANUAL: 'Manuell erfasst', } export const PASSERBY_LABELS: Record = { LOW: 'Gering', MEDIUM: 'Mittel', HIGH: 'Hoch', VERY_HIGH: 'Sehr hoch', } export function KeyFactRow({ label, value }: { label: string; value?: string | null }) { if (!value) return null return ( {label} {value} ) } export function UnitStatusChip({ unit }: { unit: PropertyUnit }) { if (unit.schattenmarktRelease?.enabled) { return } label="PRE-MARKET" sx={{ bgcolor: '#f0fdf4', color: '#1a7a4a', border: '1px solid #86efac', fontWeight: 700, fontSize: '0.68rem', height: 20 }} /> } if (unit.available) { return } return } export function UnitRow({ unit, highlighted }: { unit: PropertyUnit; highlighted: boolean }) { const availableFrom = unit.schattenmarktRelease?.availableFrom ?? unit.leaseEndDate const monthlyRent = unit.rentPricePerSqm ? Math.round(unit.rentPricePerSqm / 12) : undefined return ( {FLOOR_LABEL(unit.floorLevel)}{unit.unitLabel ? ` · ${unit.unitLabel}` : ''} {unit.currentTenant && {unit.currentTenant}} {unit.areaSqm.toLocaleString('de-CH')} m² {monthlyRent ? `CHF ${monthlyRent}/m²/Mt.` : '–'} {availableFrom ? new Date(availableFrom).toLocaleDateString('de-CH', { month: 'long', year: 'numeric' }) : '–'} ) }