/**
 * Specialization Paths Configuration
 * Defines the available career tracks for SOC analysts
 */

const SPECIALIZATION_PATHS = {
    SIEM: {
        code: 'SIEM',
        name: 'SIEM Analyst',
        description: 'Log analysis, correlation rules, Splunk/Elastic queries',
        icon: '📊',
        color: '#4F46E5', // Indigo
        focusAreas: ['Log Analysis', 'Correlation Rules', 'Query Writing', 'Dashboard Creation']
    },
    EDR: {
        code: 'EDR',
        name: 'Endpoint Detection & Response',
        description: 'Process trees, memory forensics, behavioral analysis',
        icon: '💻',
        color: '#DC2626', // Red
        focusAreas: ['Process Analysis', 'Memory Forensics', 'Behavioral Detection', 'Endpoint Isolation']
    },
    NDR: {
        code: 'NDR',
        name: 'Network Detection & Response',
        description: 'Packet analysis, IDS/IPS, network forensics',
        icon: '🌐',
        color: '#0891B2', // Cyan
        focusAreas: ['Packet Analysis', 'IDS/IPS', 'Network Forensics', 'Traffic Analysis']
    },
    TI: {
        code: 'TI',
        name: 'Threat Intelligence',
        description: 'IOC analysis, APT tracking, OSINT',
        icon: '🔍',
        color: '#7C3AED', // Violet
        focusAreas: ['IOC Analysis', 'APT Tracking', 'OSINT', 'Threat Hunting']
    },
    IR: {
        code: 'IR',
        name: 'Incident Response',
        description: 'Full-cycle IR, containment, eradication',
        icon: '🚨',
        color: '#EA580C', // Orange
        focusAreas: ['Incident Handling', 'Containment', 'Eradication', 'Recovery']
    },
    MAL: {
        code: 'MAL',
        name: 'Malware Analysis',
        description: 'Static/dynamic analysis, reverse engineering',
        icon: '🦠',
        color: '#16A34A', // Green
        focusAreas: ['Static Analysis', 'Dynamic Analysis', 'Reverse Engineering', 'Sandbox Analysis']
    },
    DLP: {
        code: 'DLP',
        name: 'Data Loss Prevention',
        description: 'Data classification, exfiltration detection',
        icon: '🔒',
        color: '#CA8A04', // Yellow
        focusAreas: ['Data Classification', 'Exfiltration Detection', 'Policy Enforcement', 'DLP Tools']
    },
    CLOUD: {
        code: 'CLOUD',
        name: 'Cloud Security',
        description: 'AWS/Azure/GCP security, CSPM alerts',
        icon: '☁️',
        color: '#2563EB', // Blue
        focusAreas: ['AWS Security', 'Azure Security', 'GCP Security', 'CSPM']
    }
};

// Core path (available to all users regardless of specialization)
const CORE_PATH = 'CORE';

// Level thresholds
const LEVEL_CONFIG = {
    FOUNDATIONS_END: 2,           // Levels 1-2: Mixed alerts, no path filter
    PATH_SELECTION_LEVEL: 3,      // Prompt user to choose path at level 3
    MAX_LEVEL: 10,
    
    // XP required per level
    XP_PER_LEVEL: [
        0,      // Level 1 (starting level)
        100,    // Level 2
        250,    // Level 3
        500,    // Level 4
        800,    // Level 5
        1200,   // Level 6
        1700,   // Level 7
        2300,   // Level 8
        3000,   // Level 9
        4000    // Level 10
    ]
};

// Daily queue configuration
const ASSIGNMENT_CONFIG = {
    DAILY_QUEUE_SIZE: 5,         // Alerts per day
    PRIMARY_PATH_WEIGHT: 0.70,    // 70% from primary path
    CORE_WEIGHT: 0.20,            // 20% from CORE
    SECONDARY_PATH_WEIGHT: 0.10,  // 10% from secondary path
    LEVEL_VARIANCE: 1,            // Allow alerts from level ± 1
    REPLAY_XP_MULTIPLIER: 0.25    // 25% XP on replays
};

// Path switch cooldown (days)
const PATH_SWITCH_COOLDOWN_DAYS = 30;

/**
 * Get path info by code
 */
function getPathInfo(pathCode) {
    return SPECIALIZATION_PATHS[pathCode] || null;
}

/**
 * Get all path codes as array
 */
function getAllPathCodes() {
    return Object.keys(SPECIALIZATION_PATHS);
}

/**
 * Get paths as array for frontend dropdown
 */
function getPathsForDropdown() {
    return Object.values(SPECIALIZATION_PATHS).map(path => ({
        value: path.code,
        label: path.name,
        description: path.description,
        icon: path.icon,
        color: path.color
    }));
}

module.exports = {
    SPECIALIZATION_PATHS,
    CORE_PATH,
    LEVEL_CONFIG,
    ASSIGNMENT_CONFIG,
    PATH_SWITCH_COOLDOWN_DAYS,
    getPathInfo,
    getAllPathCodes,
    getPathsForDropdown
};
