import type { RadioStation } from './radioTypes.js';

export async function loadRadioStations(): Promise<RadioStation[]> {
  const response = await fetch(`${import.meta.env.BASE_URL}data/radio-stations.json`);

  if (!response.ok) {
    throw new Error(`Failed to load radio stations: ${response.status}`);
  }

  const stations = (await response.json()) as RadioStation[];
  return Array.isArray(stations) ? stations : [];
}