import request from '../utils/request'

export interface CpuInfo {
  percent: number
  count: number
  load?: {
    load1: number
    load5: number
    load15: number
  } | null
}

export interface MemoryInfo {
  total: number
  used: number
  available: number
  percent: number
}

export interface DiskInfo {
  mountpoint: string
  fstype: string
  total: number
  used: number
  free: number
  percent: number
}

export interface SystemBasicInfo {
  hostname: string
  system: string
  release: string
  version: string
  machine: string
  boot_time: number
  uptime_seconds: number
}

export interface SystemStatus {
  cpu: CpuInfo
  memory: MemoryInfo
  disks: DiskInfo[]
  system: SystemBasicInfo
}

export const getSystemStatus = () => {
  return request<SystemStatus>({
    url: '/system/status',
    method: 'get',
  })
}

