"""
Analysis result containers and summary structures
"""

from dataclasses import dataclass
from typing import Dict, Any, List, Set
from .flow_stats import FlowStats


@dataclass
class AnalysisResult:
    """Container for complete analysis results"""
    total_packets: int
    unique_flows: int
    unique_ips: int
    flows: Dict[tuple, FlowStats]
    
    def get_summary(self) -> Dict[str, Any]:
        """Get analysis summary dictionary"""
        unique_ips = set()
        for flow in self.flows.values():
            unique_ips.add(flow.src_ip)
            unique_ips.add(flow.dst_ip)
        
        return {
            'total_packets': self.total_packets,
            'unique_flows': len(self.flows),
            'unique_ips': len(unique_ips),
            'flows': self.flows
        }


@dataclass
class DissectionResult:
    """Container for packet dissection results"""
    frame_number: int
    timestamp: float
    size: int
    layers: Dict[str, Any]
    protocols: List[str]
    errors: List[str] = None
    
    def __post_init__(self):
        if self.errors is None:
            self.errors = []