"use strict";
/**
 * 🏆 Score Header Display - Always visible at top
 * Shows current score + birth score in a clean box
 */
Object.defineProperty(exports, "__esModule", { value: true });
exports.generateScoreHeader = generateScoreHeader;
exports.generateScoreLine = generateScoreLine;
const colors_1 = require("../fix-once/colors");
const championship_style_1 = require("./championship-style");
/**
 * Generate the score header box (always shown unless --quiet)
 */
function generateScoreHeader(data) {
    const { currentScore, birthScore, aiPredictive, dna } = data;
    // Determine score color based on percentage
    const getScoreColor = (score) => {
        if (score >= 99) {
            return championship_style_1.FAF_COLORS.fafOrange;
        } // Big Orange territory!
        if (score >= 85) {
            return championship_style_1.FAF_COLORS.fafGreen;
        }
        if (score >= 70) {
            return championship_style_1.FAF_COLORS.fafCyan;
        }
        return championship_style_1.FAF_COLORS.fafWhite;
    };
    const scoreColor = getScoreColor(currentScore);
    // Build the score display
    let scoreDisplay = `${scoreColor(`${currentScore}%`)}`;
    // Add birth score if available
    if (birthScore !== undefined && birthScore !== currentScore) {
        const improvement = currentScore - birthScore;
        if (improvement > 0) {
            scoreDisplay += colors_1.chalk.gray(` (↑${improvement}% from birth: ${birthScore}%)`);
        }
        else if (improvement < 0) {
            scoreDisplay += colors_1.chalk.gray(` (↓${Math.abs(improvement)}% from birth: ${birthScore}%)`);
        }
    }
    // Add DNA weight info if available
    let dnaDisplay = '';
    if (dna?.currentWeight) {
        dnaDisplay = colors_1.chalk.gray(` | Weight: ${dna.currentWeight.toFixed(1)}KB`);
        if (dna.birthDNA && dna.birthDNA !== dna.currentWeight) {
            const growth = ((dna.currentWeight - dna.birthDNA) / dna.birthDNA * 100).toFixed(0);
            dnaDisplay += colors_1.chalk.gray(` (+${growth}%)`);
        }
    }
    // AI Predictive (only show if higher than current)
    let aiDisplay = '';
    if (aiPredictive && aiPredictive > currentScore) {
        aiDisplay = colors_1.chalk.gray(` > AI-Predictive: ${championship_style_1.FAF_COLORS.fafCyan(`${aiPredictive}%`)}`);
    }
    // Create the box
    return `╔════════════════════════════════════════════════════════════╗
║ 🏆 FAF Score: ${scoreDisplay}${dnaDisplay}
${aiDisplay ? `║ ${aiDisplay}\n` : ''}╚════════════════════════════════════════════════════════════╝`;
}
/**
 * Minimal score line (for when art is disabled)
 */
function generateScoreLine(data) {
    const { currentScore, birthScore } = data;
    const getScoreColor = (score) => {
        if (score >= 99) {
            return championship_style_1.FAF_COLORS.fafOrange;
        }
        if (score >= 85) {
            return championship_style_1.FAF_COLORS.fafGreen;
        }
        if (score >= 70) {
            return championship_style_1.FAF_COLORS.fafCyan;
        }
        return championship_style_1.FAF_COLORS.fafWhite;
    };
    const scoreColor = getScoreColor(currentScore);
    let line = `🏆 Score: ${scoreColor(`${currentScore}%`)}`;
    if (birthScore !== undefined && birthScore !== currentScore) {
        const improvement = currentScore - birthScore;
        if (improvement > 0) {
            line += colors_1.chalk.gray(` (Birth: ${birthScore}% ↑${improvement}%)`);
        }
    }
    return line;
}
//# sourceMappingURL=score-header.js.map