"use client"; import { fmtCurrency, fmtLarge, fmtPct } from "@/lib/format"; import type { DcfComputed } from "@/lib/dcf"; import type { DcfResult } from "@/types/api"; type Props = { dcf: DcfResult; computed: DcfComputed | { error: string } | null; livePrice: number | null; sharesOutstanding: number | null; currency: string; }; export function DcfResults({ dcf, computed, livePrice, sharesOutstanding, currency }: Props) { return (
Results
{computed && "error" in computed ? (

{computed.error}

) : ( <>
Base FCF (TTM) {dcf.base_fcf != null ? fmtLarge(dcf.base_fcf, currency) : "—"}
Historical growth {dcf.growth_rate_used != null ? fmtPct(dcf.growth_rate_used) : "—"}
FCF PV Sum {computed ? fmtLarge(computed.fcfPvSum, currency) : "—"}
Terminal Value PV {computed ? fmtLarge(computed.terminalValuePv, currency) : "—"}
Enterprise Value {computed ? fmtLarge(computed.enterpriseValue, currency) : "—"}
Net Debt {dcf.net_debt != null ? fmtLarge(dcf.net_debt, currency) : "—"}
Intrinsic Value {livePrice != null && livePrice < 0 ? "Invalid assumptions" : livePrice != null ? fmtCurrency(livePrice, 2, currency) : "—"} {sharesOutstanding != null && ( {fmtLarge(sharesOutstanding, currency)} shares )}
)}
); }