// SPDX-FileCopyrightText: 2026 Stan Grams <sjg@haxx.space>
//
// SPDX-License-Identifier: GPL-2.0-or-later

export interface SatelliteImage {
  ts_ms?: number | null;
  satellite?: string;
  channels?: string;
  channel_a?: string;
  channel_b?: string;
  mcu_count?: number;
  line_count?: number;
  path?: string;
  geo_bounds?: [number, number, number, number];
  _tsMs?: number;
  _ts?: string;
  _decoder?: "lrpt";
}

export interface LrptProgress { mcu_count?: number }
export interface SatelliteLiveUpdate { lrpt_decode_enabled?: boolean }

export interface SatellitePass {
  satellite: string;
  category: string;
  aos_ms: number;
  los_ms: number;
  duration_s: number;
  azimuth_aos_deg: number;
  azimuth_los_deg: number;
  max_elevation_deg: number;
}

export interface SatellitePassResponse {
  satellite_count?: number;
  error?: string | null;
  passes?: SatellitePass[];
}

export interface SatelliteScheduleEntry {
  id: string;
  satellite: string;
  norad_id: number;
  bookmark_id: string;
  min_elevation_deg: number;
  priority: number;
  center_hz: number | null;
  bookmark_ids: string[];
}

export interface SatelliteScheduleConfig {
  enabled: boolean;
  pretune_secs: number;
  entries: SatelliteScheduleEntry[];
}

export interface SatelliteBookmark {
  id: string;
  name: string;
  freq_hz: number;
  mode: string;
}

export interface SchedulerConfigWithSatellites {
  satellites?: SatelliteScheduleConfig;
  [key: string]: unknown;
}

export interface SatelliteSchedulerStatus { active_satellite?: string | null }

export interface SatelliteSchedulerBridge {
  getConfig(): SchedulerConfigWithSatellites | null;
  getStatus(): SatelliteSchedulerStatus | null;
  getBookmarks(): SatelliteBookmark[];
  markDirty(): void;
}

export interface SatelliteSchedulerApi {
  wireEvents(): void;
  renderSection(): void;
  renderPassStatus(): void;
  collectSatelliteConfig(): SatelliteScheduleConfig;
}
