import { Alert, Box, Button, Card, Chip, Divider, Stack, Typography } from '@mui/material' import { Banknote, Bookmark, Calendar, Columns2, MapPin, Maximize2 } from 'lucide-react' import type { UnifiedMatchResult } from '../../domain/unifiedResult' import type { Property } from '../../domain/property' import type { FutureSignal } from '../../domain/futureSignal' import { ResultConfidenceSummary } from './ResultConfidenceSummary' import { ResultTypeBadge } from './ResultTypeBadge' function scoreColor(score: number): string { if (score >= 78) return '#1a7a4a' if (score >= 52) return '#d97706' return '#c0392b' } interface Props { result: UnifiedMatchResult isInCompare: boolean onCompare: (propertyId: string) => void } export function UnifiedResultCard({ result, isInCompare, onCompare }: Props) { const { match, matchScore, resultType } = result const isFuture = resultType === 'FUTURE_AVAILABILITY' const property: Property | undefined = !isFuture ? (result as { property: Property }).property : undefined const signal: FutureSignal | undefined = isFuture ? (result as { signal: FutureSignal }).signal : undefined const compareId = property?.id ?? '' const title = property?.title ?? signal?.companyName ?? signal?.locationHint ?? '–' const city = property?.location?.city ?? signal?.locationHint ?? '–' const areaSqm = property?.areaSqm ?? signal?.areaSqmEstimate const rent = property?.rentPricePerSqm const available = property?.availabilityDate const dqScore = property?.dataQuality?.score return ( {/* FUTURE_AVAILABILITY disclaimer — always shown, non-dismissable */} {isFuture && ( {signal?.disclaimer ?? 'Probabilistisches Signal – kein bestätigtes Objekt'} )} {/* Header */} {title} {matchScore} /100 {/* Key facts */} {city} {areaSqm !== undefined && ( {areaSqm} m² )} {rent !== undefined && ( CHF {rent}/m² )} {available && ( {available} )} {isFuture && signal?.timeHorizonMonths && ( ~{signal.timeHorizonMonths} Monate · {Math.round(signal.probability * 100)}% Wahrscheinlichkeit )} {/* Positive factors */} {match.positiveFactors.length > 0 && ( Positive Faktoren {match.positiveFactors.slice(0, 3).map((f, i) => ( ))} )} {/* Tradeoffs */} {(match.tradeoffs?.length ?? 0) > 0 && ( Abwägungen {match.tradeoffs.slice(0, 2).map((t, i) => ( {t.criterion}: {t.concern} ))} )} {/* Confidence + data quality */} {/* Actions */} {!isFuture && ( )} ) }