Add Flights Map dictionaries type module

This commit is contained in:
2026-04-17 03:09:39 +03:00
parent 9f8a3a45f0
commit da605f0576
+93
View File
@@ -0,0 +1,93 @@
/**
* Flights-map dictionaries types.
*
* Processed shapes live at the top (consumer-facing). Raw response shapes
* live at the bottom (private to api.ts and transform.ts).
*/
export interface IAirport {
code: string;
name: string;
city_code: string;
location: { lat: number; lon: number };
has_afl_flights: boolean;
}
export interface ICity {
code: string;
name: string;
location: { lat: number; lon: number };
country_code: string;
countryName: string;
has_afl_flights: boolean;
airports: IAirport[];
}
export interface ICountry {
code: string;
name: string;
world_region_id: number;
}
export interface IRegion {
id: number;
name: string;
countries: ICountry[];
}
export interface IDictionaries {
regions: IRegion[];
countries: ICountry[];
cities: ICity[];
airports: IAirport[];
cityByCode: Map<string, ICity>;
airportByCode: Map<string, IAirport>;
ruCityCodes: Set<string>;
otherCityCodes: Set<string>;
}
export interface IDictionariesState {
dictionaries: IDictionaries | null;
loading: boolean;
error: Error | null;
}
// ---------------------------------------------------------------------------
// Raw response shapes (private: api.ts returns these; transform.ts consumes them)
// ---------------------------------------------------------------------------
export interface IRawCity {
code: string;
title: Record<string, string>;
location?: { lat: number; lon: number };
country_code: string;
has_afl_flights?: boolean;
}
export interface IRawAirport {
code: string;
city_code: string;
title: Record<string, string>;
location?: { lat: number; lon: number };
has_afl_flights: boolean;
}
export interface IRawCountry {
code: string;
title: Record<string, string>;
world_region_id: number;
}
export interface IRawRegion {
world_region_id: number;
title: Record<string, string>;
}
export interface IRawDictionaries {
regions: IRawRegion[];
countries: IRawCountry[];
cities: IRawCity[];
airports: IRawAirport[];
}