"""
Configuration v2.0 - Zero Risk Production Settings
"""
import os
from pathlib import Path

# Load .env file if present
try:
    from dotenv import load_dotenv
    env_path = Path(__file__).resolve().parent / ".env"
    # print(f"🔍 Looking for .env at: {env_path}")
    load_dotenv(dotenv_path=env_path)
except ImportError:
    pass  # dotenv not installed, use system env

# Base Directory
BASE_DIR = Path(__file__).resolve().parent

# Data Paths
DATA_DIR = BASE_DIR / "data"
OUTPUT_DIR = BASE_DIR / "output"

# Ensure directories exist
DATA_DIR.mkdir(parents=True, exist_ok=True)
OUTPUT_DIR.mkdir(parents=True, exist_ok=True)

# API Configuration
ANTHROPIC_API_KEY = os.getenv("ANTHROPIC_API_KEY")

# Model Settings
LLM_MODEL = "claude-3-haiku-20240307"  # Stable, cost-effective
LLM_TEMPERATURE = 0.5  # Balance between creativity and consistency
LLM_MAX_TOKENS = 4000

# Batch Processing
BATCH_SIZE = 50  # Students per batch
QUESTIONS_PER_PROMPT = 15  # Optimized for reliability (avoiding LLM refusals)
LLM_DELAY = 0.5  # Optimized for Turbo Production (Phase 9)
MAX_WORKERS = 5  # Thread pool size for concurrent simulation

# Dry Run Settings (set to None for full run)
# DRY_RUN: 1 adolescent + 1 adult across all domains
DRY_RUN_STUDENTS = 2  # Set to None for full run

# Domain Configuration
DOMAINS = [
    'Personality',
    'Grit',
    'Emotional Intelligence',
    'Vocational Interest',
    'Learning Strategies',
]

# Age Groups
AGE_GROUPS = {
    'adolescent': '14-17',
    'adult': '18-23',
}

# Cognition Test Names
COGNITION_TESTS = [
    'Cognitive_Flexibility_Test',
    'Color_Stroop_Task',
    'Problem_Solving_Test_MRO',
    'Problem_Solving_Test_MR',
    'Problem_Solving_Test_NPS',
    'Problem_Solving_Test_SBDM',
    'Reasoning_Tasks_AR',
    'Reasoning_Tasks_DR',
    'Reasoning_Tasks_NR',
    'Response_Inhibition_Task',
    'Sternberg_Working_Memory_Task',
    'Visual_Paired_Associates_Test'
]

# Output File Names for Cognition
COGNITION_FILE_NAMES = {
    'Cognitive_Flexibility_Test': 'Cognitive_Flexibility_Test_{age}.xlsx',
    'Color_Stroop_Task': 'Color_Stroop_Task_{age}.xlsx',
    'Problem_Solving_Test_MRO': 'Problem_Solving_Test_MRO_{age}.xlsx',
    'Problem_Solving_Test_MR': 'Problem_Solving_Test_MR_{age}.xlsx',
    'Problem_Solving_Test_NPS': 'Problem_Solving_Test_NPS_{age}.xlsx',
    'Problem_Solving_Test_SBDM': 'Problem_Solving_Test_SBDM_{age}.xlsx',
    'Reasoning_Tasks_AR': 'Reasoning_Tasks_AR_{age}.xlsx',
    'Reasoning_Tasks_DR': 'Reasoning_Tasks_DR_{age}.xlsx',
    'Reasoning_Tasks_NR': 'Reasoning_Tasks_NR_{age}.xlsx',
    'Response_Inhibition_Task': 'Response_Inhibition_Task_{age}.xlsx',
    'Sternberg_Working_Memory_Task': 'Sternberg_Working_Memory_Task_{age}.xlsx',
    'Visual_Paired_Associates_Test': 'Visual_Paired_Associates_Test_{age}.xlsx'
}
# Output File Names for Survey
OUTPUT_FILE_NAMES = {
    'Personality': 'Personality_{age}.xlsx',
    'Grit': 'Grit_{age}.xlsx',
    'Emotional Intelligence': 'Emotional_Intelligence_{age}.xlsx',
    'Vocational Interest': 'Vocational_Interest_{age}.xlsx',
    'Learning Strategies': 'Learning_Strategies_{age}.xlsx',
}
