package api import ( "net/http" "jukebox_maker/internal/disk" ) func (s *Server) handleDiskStatus(w http.ResponseWriter, r *http.Request) { info := s.deps.Watcher.CurrentDisk() type response struct { State disk.DiskState `json:"state"` DiskID string `json:"disk_id"` TotalBytes int64 `json:"total_bytes"` FreeBytes int64 `json:"free_bytes"` MountPath string `json:"mount_path"` ActiveTaskID string `json:"active_task_id,omitempty"` } resp := response{ State: info.State, DiskID: info.DiskID, TotalBytes: info.TotalBytes, FreeBytes: info.FreeBytes, MountPath: info.MountPath, } if t, ok := s.deps.Tasks.ActiveTask(); ok { resp.ActiveTaskID = t.ID } jsonOK(w, resp) }