import { apiFetch } from "../../api/apiFetch"; export type PlanSurveyMode = { id: number; planId: number; timeStart: string | null; revolution: number; type: "SURVEY"; status: string; lat: number; longitude: number; duration: number; contourWkt: string | null; roll: number; /** Объём маршрута, МБ (скорость накопления × длительность). Считает бэк (pcp-types-lib). */ volumeMb?: number; }; export type PlanDropMode = { id: number; planId: number; timeStart: string | null; revolution: number; type: "DROP"; station: string | null; duration: number; surveys: number[]; /** Объём сброса, Мбайт (канал 1200 Мбит/с ÷ 8 × длительность). Считает бэк (pcp-types-lib). */ volumeMb?: number; }; export type PlanMode = PlanSurveyMode | PlanDropMode; export async function fetchPlanModes(planId: string): Promise { const response = await apiFetch( `/api/pcp-mission/api/missions/${encodeURIComponent(planId)}/modes`, { headers: { Accept: "application/json" } } ); if (!response.ok) { throw new Error(`Ошибка загрузки включений плана: ${response.status}`); } return response.json() as Promise; }