import * as fs from 'fs';
import * as path from 'path';
/**
 * Handles theme selection and CSS generation
 */
export class ThemeManager {
    themesDir;
    constructor(themesDir) {
        this.themesDir = themesDir;
    }
    /**
     * Parse theme argument from command line
     */
    parseThemeArg(themeArg) {
        if (themeArg === 'all')
            return 'all';
        const validThemes = ['space', 'mythical', 'ancient', 'developer'];
        // Check if it's a direct theme name
        if (validThemes.includes(themeArg)) {
            return themeArg;
        }
        // Check if it's a number (1-4)
        const themeNum = parseInt(themeArg);
        if (themeNum >= 1 && themeNum <= 4) {
            return validThemes[themeNum - 1];
        }
        return null;
    }
    /**
     * Check if theme uses light background (needs dark logo)
     */
    isLightTheme(theme) {
        // Light themes that need dark GitHub logo (github-mark.svg)
        const lightThemes = ['mythical'];
        return lightThemes.includes(theme);
    }
    /**
     * Get appropriate GitHub logo path based on theme
     */
    getGitHubLogo(theme) {
        return this.isLightTheme(theme)
            ? 'assets/shared/github-mark.svg' // Dark logo for light themes
            : 'assets/shared/github-mark-white.svg'; // White logo for dark themes
    }
    /**
     * Generate combined CSS for a theme
     */
    generateThemeCSS(theme, outputDir) {
        const cssFiles = [
            path.join(this.themesDir, 'base.css'),
            path.join(this.themesDir, 'homepage.css'),
            path.join(this.themesDir, 'animations.css'),
            path.join(this.themesDir, `${theme}.css`)
        ];
        let combinedCSS = '';
        cssFiles.forEach(cssFile => {
            if (fs.existsSync(cssFile)) {
                combinedCSS += fs.readFileSync(cssFile, 'utf8') + '\\n\\n';
            }
        });
        const cssPath = path.join(outputDir, 'assets', 'theme.css');
        fs.writeFileSync(cssPath, combinedCSS);
    }
    /**
     * Get theme-specific icons for templates
     */
    getThemeIcons(theme) {
        const themeIcons = {
            space: { theme: '🚀', quest: '⭐' },
            mythical: { theme: '🏰', quest: '⚔️' },
            ancient: { theme: '🏺', quest: '📜' },
            developer: { theme: '💻', quest: '🔧' },
            custom: { theme: '🎨', quest: '⭐' }
        };
        return themeIcons[theme] || themeIcons.space;
    }
}
//# sourceMappingURL=theme-manager.js.map