diff --git a/src/shared/dictionaries/types.ts b/src/shared/dictionaries/types.ts new file mode 100644 index 00000000..910e05fb --- /dev/null +++ b/src/shared/dictionaries/types.ts @@ -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; + airportByCode: Map; + + ruCityCodes: Set; + otherCityCodes: Set; +} + +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; + location?: { lat: number; lon: number }; + country_code: string; + has_afl_flights?: boolean; +} + +export interface IRawAirport { + code: string; + city_code: string; + title: Record; + location?: { lat: number; lon: number }; + has_afl_flights: boolean; +} + +export interface IRawCountry { + code: string; + title: Record; + world_region_id: number; +} + +export interface IRawRegion { + world_region_id: number; + title: Record; +} + +export interface IRawDictionaries { + regions: IRawRegion[]; + countries: IRawCountry[]; + cities: IRawCity[]; + airports: IRawAirport[]; +}