from typing import List, Dict, Any
from health.utils.logging_config import setup_logger

logger = setup_logger(__name__)

class ContextCompressor:
    """Manages context size and compression."""

    MAX_HISTORY = 20 # Keep last 20 messages for now (simple sliding window)

    @staticmethod
    def compress(context: List[Dict[str, Any]]) -> List[Dict[str, Any]]:
        """
        Simple truncation compressor.
        TODO: Implement LLM-based summarization.
        """
        if len(context) > ContextCompressor.MAX_HISTORY:
            # Always keep the first message if it's a system prompt (not handling system prompts in storage list yet)
            # Just slice the last N
            return context[-ContextCompressor.MAX_HISTORY:]
        return context
