package types import "time" // SystemMetrics represents comprehensive system performance metrics type SystemMetrics struct { // System Information Hostname string `json:"hostname"` Platform string `json:"platform"` PlatformFamily string `json:"platform_family"` PlatformVersion string `json:"platform_version"` KernelVersion string `json:"kernel_version"` KernelArch string `json:"kernel_arch"` // CPU Metrics CPUUsage float64 `json:"cpu_usage"` CPUCores int `json:"cpu_cores"` CPUModel string `json:"cpu_model"` // Memory Metrics MemoryUsage float64 `json:"memory_usage"` MemoryTotal uint64 `json:"memory_total"` MemoryUsed uint64 `json:"memory_used"` MemoryFree uint64 `json:"memory_free"` MemoryAvailable uint64 `json:"memory_available"` SwapTotal uint64 `json:"swap_total"` SwapUsed uint64 `json:"swap_used"` SwapFree uint64 `json:"swap_free"` // Disk Metrics DiskUsage float64 `json:"disk_usage"` DiskTotal uint64 `json:"disk_total"` DiskUsed uint64 `json:"disk_used"` DiskFree uint64 `json:"disk_free"` // Network Metrics NetworkInKbps float64 `json:"network_in_kbps"` NetworkOutKbps float64 `json:"network_out_kbps"` NetworkInBytes uint64 `json:"network_in_bytes"` NetworkOutBytes uint64 `json:"network_out_bytes"` // System Load LoadAvg1 float64 `json:"load_avg_1"` LoadAvg5 float64 `json:"load_avg_5"` LoadAvg15 float64 `json:"load_avg_15"` // Process Information ProcessCount int `json:"process_count"` // Network Information IPAddress string `json:"ip_address"` Location string `json:"location"` // Filesystem Information FilesystemInfo []FilesystemInfo `json:"filesystem_info"` BlockDevices []BlockDevice `json:"block_devices"` // Timestamp Timestamp time.Time `json:"timestamp"` } // FilesystemInfo represents individual filesystem statistics type FilesystemInfo struct { Mountpoint string `json:"mountpoint"` Fstype string `json:"fstype"` Total uint64 `json:"total"` Used uint64 `json:"used"` Free uint64 `json:"free"` UsagePercent float64 `json:"usage_percent"` } // BlockDevice represents block device information type BlockDevice struct { Name string `json:"name"` Size uint64 `json:"size"` Model string `json:"model"` SerialNumber string `json:"serial_number"` } // NetworkStats represents detailed network interface statistics type NetworkStats struct { InterfaceName string `json:"interface_name"` BytesSent uint64 `json:"bytes_sent"` BytesRecv uint64 `json:"bytes_recv"` PacketsSent uint64 `json:"packets_sent"` PacketsRecv uint64 `json:"packets_recv"` ErrorsIn uint64 `json:"errors_in"` ErrorsOut uint64 `json:"errors_out"` DropsIn uint64 `json:"drops_in"` DropsOut uint64 `json:"drops_out"` } // AuthToken represents the authentication token structure type AuthToken struct { AccessToken string `json:"access_token"` RefreshToken string `json:"refresh_token"` ExpiresAt time.Time `json:"expires_at"` TokenType string `json:"token_type"` AgentID string `json:"agent_id"` } // DeviceAuthRequest represents the device authorization request type DeviceAuthRequest struct { ClientID string `json:"client_id"` Scope string `json:"scope,omitempty"` } // DeviceAuthResponse represents the device authorization response type DeviceAuthResponse struct { DeviceCode string `json:"device_code"` UserCode string `json:"user_code"` VerificationURI string `json:"verification_uri"` ExpiresIn int `json:"expires_in"` Interval int `json:"interval"` } // TokenRequest represents the token request for device flow type TokenRequest struct { GrantType string `json:"grant_type"` DeviceCode string `json:"device_code,omitempty"` RefreshToken string `json:"refresh_token,omitempty"` ClientID string `json:"client_id,omitempty"` } // TokenResponse represents the token response type TokenResponse struct { AccessToken string `json:"access_token"` RefreshToken string `json:"refresh_token"` TokenType string `json:"token_type"` ExpiresIn int `json:"expires_in"` AgentID string `json:"agent_id,omitempty"` Error string `json:"error,omitempty"` ErrorDescription string `json:"error_description,omitempty"` } // HeartbeatRequest represents the agent heartbeat request type HeartbeatRequest struct { AgentID string `json:"agent_id"` Status string `json:"status"` Metrics SystemMetrics `json:"metrics"` } // MetricsRequest represents the flattened metrics payload expected by agent-auth-api type MetricsRequest struct { // Agent identification AgentID string `json:"agent_id"` // Basic metrics CPUUsage float64 `json:"cpu_usage"` MemoryUsage float64 `json:"memory_usage"` DiskUsage float64 `json:"disk_usage"` // Network metrics NetworkInKbps float64 `json:"network_in_kbps"` NetworkOutKbps float64 `json:"network_out_kbps"` // System information IPAddress string `json:"ip_address"` Location string `json:"location"` AgentVersion string `json:"agent_version"` KernelVersion string `json:"kernel_version"` DeviceFingerprint string `json:"device_fingerprint"` // Structured data (JSON fields in database) LoadAverages map[string]float64 `json:"load_averages"` OSInfo map[string]string `json:"os_info"` FilesystemInfo []FilesystemInfo `json:"filesystem_info"` BlockDevices []BlockDevice `json:"block_devices"` NetworkStats map[string]uint64 `json:"network_stats"` }