import type { UpdatePort, UpdateInfo } from '@domain/ports/UpdatePort';

export class GiteaUpdateAdapter implements UpdatePort {
  async checkForUpdates(): Promise<UpdateInfo | null> {
    // Delegated to main process via IPC in the actual Electron app
    // This is a placeholder — the real check happens in main.ts
    return null;
  }

  downloadAndInstall(info: UpdateInfo): void {
    const api = (window as any).electronAPI;
    if (api?.installUpdate) {
      api.installUpdate();
    }
  }
}
