"""Core data structures for infrastructure monitoring"""

# AUTOGENERATED! DO NOT EDIT! File to edit: ../nbs/core.ipynb.

# %% auto 0
__all__ = ['SystemStats']

# %% ../nbs/core.ipynb 3
from dataclasses import dataclass, field, asdict
from typing import Dict, Any

# %% ../nbs/core.ipynb 5
@dataclass
class SystemStats:
    """Standardized snapshot of system resources."""
    
    # CPU Stats
    cpu_percent: float = 0.0  # Overall CPU utilization percentage
    
    # Memory Stats (Used by Scheduler for RAM checks)
    memory_used_mb: float = 0.0  # Currently used system RAM in MB
    memory_total_mb: float = 0.0  # Total system RAM in MB
    memory_available_mb: float = 0.0  # Available system RAM in MB
    
    # GPU Stats (Used by Scheduler for VRAM checks)
    gpu_type: str = "None"  # GPU vendor: 'NVIDIA', 'AMD', 'Intel', 'None'
    gpu_free_memory_mb: float = 0.0  # Free GPU memory in MB (sum of all visible devices)
    gpu_total_memory_mb: float = 0.0  # Total GPU memory in MB
    gpu_used_memory_mb: float = 0.0  # Used GPU memory in MB
    gpu_load_percent: float = 0.0  # GPU compute utilization percentage
    
    # Detailed Breakdown (Optional, for UI Dashboards)
    details: Dict[str, Any] = field(default_factory=dict)  # Per-device stats, temperatures, etc.

    def to_dict(self) -> Dict[str, Any]:  # Dictionary representation for JSON serialization
        """Convert to dictionary for JSON serialization."""
        return asdict(self)
