function formatUsd(amount) {
    return `$${amount.toFixed(2)}`;
}
function formatShare(part, total) {
    if (total <= 0)
        return '0%';
    return `${Math.round((part / total) * 100)}%`;
}
export class TokenUsageSummaryPresenter {
    present(summary) {
        const models = Object.entries(summary.byModel)
            .map(([name, stats]) => ({
            name,
            count: stats.count,
            costUsd: formatUsd(stats.costUsd),
            costShare: formatShare(stats.costUsd, summary.totalCostUsd),
        }))
            .sort((a, b) => {
            const costA = summary.byModel[a.name]?.costUsd ?? 0;
            const costB = summary.byModel[b.name]?.costUsd ?? 0;
            return costB - costA;
        });
        return {
            totalCostUsd: formatUsd(summary.totalCostUsd),
            recordCount: summary.recordCount,
            totalTokens: summary.totalInputTokens + summary.totalOutputTokens,
            models,
            isEmpty: summary.recordCount === 0,
        };
    }
}
//# sourceMappingURL=tokenUsageSummary.presenter.js.map