"""Carga de configuración desde config.yaml (con valores por defecto)."""

import os
import yaml

DEFAULTS = {
    "provider": "mock",
    "summarizer": "simple",
    "accounts_path": "data/accounts.json",
    "window_hours": 48,
    "top_n": 10,
    "recency_halflife_hours": 18,
    "topics": ["AI", "LLM", "agent", "model", "open source", "research", "GPT", "robot"],
    "weights": {"likes": 1.0, "retweets": 2.0, "replies": 1.5, "quotes": 1.5},
}


def load_config(path: str = "config.yaml") -> dict:
    cfg = dict(DEFAULTS)
    if os.path.exists(path):
        with open(path, "r", encoding="utf-8") as f:
            user = yaml.safe_load(f) or {}
        cfg.update({k: v for k, v in user.items() if v is not None})
    return cfg
