/**
 * System status data shapes for Onebox
 */

import type { TPlatformServiceStatus, TPlatformServiceType } from './platform.ts';

export interface IOneboxUpdateStatus {
  currentVersion: string;
  latestVersion: string | null;
  updateAvailable: boolean;
  checkedAt: number;
  releaseUrl: string;
  changelogUrl: string;
  error?: string;
}

export interface IOneboxUpgradeStartResult {
  accepted: boolean;
  currentVersion: string;
  targetVersion: string;
  message: string;
  pid?: number;
  unitName?: string;
  logPath?: string;
}

export interface ISystemStatus {
  onebox: {
    version: string;
    update: IOneboxUpdateStatus;
  };
  docker: {
    running: boolean;
    version: unknown;
    cpuUsage: number;
    memoryUsage: number;
    memoryTotal: number;
    networkIn: number;
    networkOut: number;
  };
  reverseProxy: {
    http: { running: boolean; port: number };
    https: { running: boolean; port: number; certificates: number };
    routes: number;
  };
  dns: { configured: boolean };
  ssl: { configured: boolean; certificateCount: number };
  services: { total: number; running: number; stopped: number };
  platformServices: Array<{
    type: TPlatformServiceType;
    displayName: string;
    status: TPlatformServiceStatus;
    resourceCount: number;
  }>;
  certificateHealth: {
    valid: number;
    expiringSoon: number;
    expired: number;
    expiringDomains: Array<{ domain: string; daysRemaining: number }>;
  };
}
