"""Configuracion global de AR-House."""

APP_NAME = "AR-House"
APP_VERSION = "0.1.0"

# Modo de uso de recursos:
#   low_power   -> secuencial estricto, keep_alive=0 (default, para 12GB VRAM)
#   balanced    -> secuencial, keep_alive=300s (reutiliza modelos en sesiones cortas)
#   performance -> paralelo (>16GB VRAM, no implementado todavia)
RESOURCE_MODE = "low_power"

KEEP_ALIVE_BY_MODE = {
    "low_power":   0,
    "balanced":    300,
    "performance": 600,
}

# ETA por agente en modo low_power (carga + inferencia, segundos)
# Calibrado contra smoke tests reales en 12GB VRAM / 32GB RAM
AGENT_ETA_LOW_POWER = {
    "PhotoInspector":          30,
    "DealAnalyzer":            45,
    "FloridaResearcher":       25,
    "LenderMatcher":           50,
    "Coordinator":             75,
    "ValueEstimator":          50,  # Wave 2
    "OfferStrategist":         55,  # Wave 2
    "ContextualGlossaryAgent": 90,  # mas grande post-Wave 2 (recibe value + offer adicionales)
}
ANALYSIS_ETA_SECONDS = sum(AGENT_ETA_LOW_POWER.values())  # ~420s = ~7 min

OLLAMA_HOST = "http://localhost:11434"
ANALYSES_DIR = "analyses"

# Markets DB (Phase 3E - selector dinamico de mercados)
MARKETS_DB_FILE = "markets_database.json"
USER_ACTIVE_MARKETS_FILE = "user_active_markets.json"

# ═══════════════════════════════════════════════════════════════════════════
# Phase 3 — DealFinder configuration
# ═══════════════════════════════════════════════════════════════════════════

# SQLite database for deals pipeline
DEALS_DB_PATH = "data/deals.db"

# DealClassifier model name (light Ollama model for fast classification)
DEAL_CLASSIFIER_MODEL = "DealClassifier"

# Firecrawl monthly budget (free tier: 1000 credits/mes)
FIRECRAWL_CREDIT_BUDGET = 500              # 50% del free tier — margen seguro
FIRECRAWL_ALERT_THRESHOLD_PCT = 80         # alert al usuario al 80% del budget (400 cr)
FIRECRAWL_PAUSE_THRESHOLD_PCT = 95         # auto-pause DealFinder al 95% del budget (475 cr)

# Phase 3 scraper schedules
DEALFINDER_SCHEDULE_HOUR = 6               # 6 AM daily (Windows Task Scheduler)
DEALFINDER_VBS_LAUNCHER = "scripts/AR-House-DealFinder.vbs"

# Deal status lifecycle (canonical values for deals.db.status)
DEAL_STATUS_NEW = "new"
DEAL_STATUS_CLASSIFIED = "classified"
DEAL_STATUS_VIEWED = "viewed"
DEAL_STATUS_INTERESTING = "interesting"
DEAL_STATUS_DISMISSED = "dismissed"
DEAL_STATUS_ANALYZED = "analyzed"
DEAL_STATUS_VALUES = [
    DEAL_STATUS_NEW, DEAL_STATUS_CLASSIFIED, DEAL_STATUS_VIEWED,
    DEAL_STATUS_INTERESTING, DEAL_STATUS_DISMISSED, DEAL_STATUS_ANALYZED,
]

# DealClassifier classification status (canonical values for deals.db.classification_status)
CLASS_POTENTIAL_WINNER = "potential_winner"  # high score, looks promising
CLASS_MAYBE = "maybe"                         # marginal, needs deeper look
CLASS_PASS = "pass"                           # clear pass, doesn't fit criteria
CLASS_RED_FLAG = "red_flag"                   # flagged for risk pattern (foreclosure heredable, etc)
CLASSIFICATION_VALUES = [
    CLASS_POTENTIAL_WINNER, CLASS_MAYBE, CLASS_PASS, CLASS_RED_FLAG,
]

# Data fetchers (Wave 1 - real-data layer antes de los agentes)
CACHE_DIR = ".cache/data_fetchers"
HURDAT2_FILE = "data/hurdat2.txt"
HURDAT2_MAX_AGE_DAYS = 365
