import { Machine } from '../renderer/types';

export type LogLevel = 'error' | 'warn' | 'info' | 'debug';
export type MachineAction = 'start' | 'stop' | 'restart';

export interface MachineResponse {
  success: boolean;
  message: string;
  machines?: Machine[];
  status?: 'running' | 'stopped' | 'error' | 'unknown' | 'checking';
  details?: Record<string, unknown>;
}

export interface ElectronAPI {
  connectToMachine: (machine: Machine) => Promise<MachineResponse>;
  controlMachine: (machineId: string, action: MachineAction) => Promise<MachineResponse>;
  getMachineStatus: (machineId: string) => Promise<MachineResponse>;
  getMachineList: () => Promise<MachineResponse>;
  logEvent: (level: LogLevel, tag: string, message: string, context?: Record<string, unknown>) => void;
  
  // ✅ ИСПРАВЛЕНО: Безопасное хранилище (Electron safeStorage)
  encryptData: (plaintext: string) => Promise<string>;
  decryptData: (encrypted: string) => Promise<string>;
  isEncryptionAvailable: () => Promise<boolean>;
}

declare global {
  interface Window {
    electronAPI: ElectronAPI;
  }
} 