import type { Property, PropertyUnit } from '../domain/property' export interface ResolvedUnitFacts { fitOut?: 'SHELL' | 'BASIC' | 'FULL' | 'PREMIUM' mabPerSqm: number fitOutByLandlord?: boolean parkingSpots?: number rentPricePerSqm: number } /** * Effektive Ausbau-/Preis-/Parkplatz-Werte für eine Einheit: Einheit-Wert ?? Objekt-Wert. * Parkplätze: Einheit-Zuteilung; bei Einzel-Einheit-Objekten der ganze Objekt-Pool als Fallback. */ export function resolveUnitFacts(property: Property, unit?: PropertyUnit | null): ResolvedUnitFacts { const hf = property.hardFacts const singleUnit = (property.units?.length ?? 0) <= 1 return { fitOut: unit?.fitOut ?? hf?.fitOut, mabPerSqm: unit?.mieterausbaubeitragPerSqm ?? hf?.mieterausbaubeitragPerSqm ?? 0, fitOutByLandlord: unit?.fitOutByLandlord ?? hf?.fitOutByLandlord, parkingSpots: unit?.parkingSpots ?? (singleUnit ? hf?.parking : undefined), rentPricePerSqm: unit?.rentPricePerSqm ?? property.rentPricePerSqm, } }