export type StationDto = {
  id: string | null;
  number: number;
  name: string;
  position: { lat: number; long: number; height: number };
  elevationMin: number;
  elevationMax: number;
};

export async function fetchStations(): Promise<StationDto[]> {
  const response = await fetch("/api/stations", {
    headers: { Accept: "application/json" }
  });
  if (!response.ok) {
    throw new Error(`Ошибка загрузки станций: ${response.status}`);
  }
  return response.json() as Promise<StationDto[]>;
}
