use crate::{
  components::home::Mode,
  journal::LogEntry,
  systemd::{ServiceList, UnitFile, UnitId, UnitRuntimeInfo},
};

#[derive(Debug, Clone)]
pub enum Action {
  Quit,
  Render,
  DebouncedRender,
  SpinnerTick,
  Resize(u16, u16),
  ToggleShowLogger,
  RefreshServices,
  RefreshUnitFiles,
  RefreshUnitRuntimeInfo(UnitId),
  RefreshStatusFilterMenu,
  SetServices(ServiceList),
  SetUnitFiles(Vec<UnitFile>),
  EnterMode(Mode),
  EnterError(String),
  ServicesRefreshFailed(String),
  CancelTask,
  ToggleHelp,
  SetUnitFilePath { unit: UnitId, path: Result<String, String> },
  SetUnitRuntimeInfo { unit: UnitId, info: Box<UnitRuntimeInfo> },
  CopyUnitFilePath,
  SetLogs { unit: UnitId, logs: Vec<LogEntry> },
  AppendLogLines { unit: UnitId, lines: Vec<LogEntry> },
  StartService(UnitId),
  StopService(UnitId),
  RestartService(UnitId),
  ReloadUnit(UnitId),
  DaemonReload(UnitId),
  EnableService(UnitId),
  DisableService { unit: UnitId, runtime: bool },
  MaskUnit(UnitId),
  UnmaskUnit { unit: UnitId, runtime: bool },
  ResetFailedUnit(UnitId),
  KillService(UnitId, String),
  ScrollUp(u16),
  ScrollDown(u16),
  ScrollToTop,
  ScrollToBottom,
  ToggleLogOrder,
  EditUnitFile { unit: UnitId, path: String },
  OpenLogsInPager { logs: Vec<String> },
  Noop,
}
