//! System-related data structures

/// Describes system memory usage information
#[derive(Clone, Debug, Default)]
pub struct SystemMemoryStats {
    /// Total number of pages in the system
    pub total_usable_pages: usize,
    /// Amount of used/allocated memory
    pub allocated_pages: usize,
    /// Amount of usable/free memory
    pub free_pages: usize,
    /// Single page size
    pub page_size: usize,
}

option_group!(
    #[doc = "System information requests"]
    pub enum SystemInfoVariant<'de> {
        #[doc = "Memory usage information"]
        0x1000: MemoryUsage # 64 (SystemMemoryStats),
    }
);

request_group!(
    #[doc = "Common system controls"]
    pub enum SystemControlVariant<'de> {
        #[doc = "Power down the system"]
        0x1000: PowerOff((), ()),
    }
);

abi_serde::impl_struct_serde!(
    SystemMemoryStats: [total_usable_pages, allocated_pages, free_pages, page_size]
);
