import type L from 'leaflet';

export interface LatLngPosition {
  lat: number;
  lng: number;
}

export interface FlightPoint {
  id: string;
  position: LatLngPosition;
  altitude: number;
  meta: string[];
}

export interface CalculatedPointInfo {
  bat: number;
  time: number;
}

export interface MapRectangle {
  layer?: L.Layer;
  color: string;
  bounds: L.LatLngBounds | L.LatLngBoundsLiteral;
  id?: string;
}

export interface ThrustWattEntry {
  thrust: number;
  watts: number;
}

export interface AircraftParams {
  type: string;
  downang: number;
  upang: number;
  weight: number;
  speed: number;
  frontalArea: number;
  dragCoefficient: number;
  batteryCapacity: number;
  thrustWatts: ThrustWattEntry[];
  propellerEfficiency: number;
}

export interface WeatherData {
  windSpeed: number;
  windAngle: number;
}

export interface Purpose {
  value: string;
  label: string;
}

export interface Language {
  code: string;
  flag: string;
}

export interface MovingPointInfo {
  x: number;
  y: number;
  latlng: L.LatLng;
}

export const ActionMode = {
  points: 'points',
  workArea: 'workArea',
  prohibitedArea: 'prohibitedArea',
} as const;

export type ActionModeValue = (typeof ActionMode)[keyof typeof ActionMode];

export const MapType = {
  classic: 'classic',
  satellite: 'satellite',
} as const;

export type MapTypeValue = (typeof MapType)[keyof typeof MapType];

export interface FlightStatusTranslations {
  good: string;
  caution: string;
  low: string;
}

export interface OptionsTranslations {
  artillery: string;
  tank: string;
  [key: string]: string;
}

export interface TranslationStrings {
  language: string;
  aircraft: string;
  label: string;
  point: string;
  height: string;
  edit: string;
  currentPos: string;
  return: string;
  addPoints: string;
  workArea: string;
  prohibitedArea: string;
  location: string;
  currentLocation: string;
  exportData: string;
  exportPlaneData: string;
  exportMapData: string;
  editAsJson: string;
  importFromJson: string;
  export: string;
  import: string;
  operations: string;
  rectangleColor: string;
  red: string;
  green: string;
  initialAltitude: string;
  setAltitude: string;
  setPoint: string;
  removePoint: string;
  windSpeed: string;
  windDirection: string;
  setWind: string;
  title: string;
  distanceLabel: string;
  fuelRequiredLabel: string;
  maxFuelLabel: string;
  flightStatus: FlightStatusTranslations;
  calc: string;
  error: string;
  km: string;
  metres: string;
  litres: string;
  hour: string;
  minutes: string;
  battery: string;
  titleAdd: string;
  titleEdit: string;
  description: string;
  latitude: string;
  longitude: string;
  altitude: string;
  purpose: string;
  cancel: string;
  submitAdd: string;
  submitEdit: string;
  options: OptionsTranslations;
  invalid: string;
  editm: string;
  save: string;
}

export type TranslationsMap = Record<string, TranslationStrings>;
