import { Language } from '@shared/enumerators';
import { GeoService, LocalizationService } from '@shared/services';
import { NetworkService } from '@shared/services/network.service';
import { AirportModel, CityModel } from '../models';
import { DictionariesService } from './dictionaries-service';

const cities: Partial<CityModel>[] = [
    {
        title: {
            ru: 'Магадан',
        },
        code: 'GDX',
        country_code: 'RU',
    },
    {
        title: {
            ru: 'Магас (Назрань)',
        },
        code: 'IGT',
        country_code: 'RU',
    },
    {
        title: {
            ru: 'Магнитогорск',
        },
        code: 'MQF',
        country_code: 'RU',
    },
    {
        title: {
            ru: 'Мадрид',
        },
        code: 'MAD',
        country_code: 'ES',
    },
    {
        title: {
            ru: 'Майами',
        },
        code: 'MIA',
        country_code: 'US',
    },
    {
        title: {
            ru: 'Малага',
        },
        code: 'AGP',
        country_code: 'ES',
    },
    {
        title: {
            ru: 'Мале',
        },
        code: 'MLE',
        country_code: 'MV',
    },
    {
        title: {
            ru: 'Марсель',
        },
        code: 'MRS',
        country_code: 'FR',
    },
    {
        title: {
            ru: 'Махачкала',
        },
        code: 'MCX',
        country_code: 'RU',
    },
    {
        title: {
            ru: 'Маэ Сейшелы',
        },
        code: 'SEZ',
        country_code: 'SC',
    },
    {
        title: {
            ru: 'Москва',
        },
        code: 'MOW',
        country_code: 'RU',
    },
    {
        title: {
            ru: 'Балтимор',
        },
        code: 'BWI',
        country_code: 'US',
    },
    {
        title: {
            ru: 'Ричмонд',
        },
        code: 'RIC',
        country_code: 'US',
    },
];

const airports: Partial<AirportModel>[] = [
    {
        title: {
            ru: 'Внуково',
        },
        city_code: 'MOW',
        code: 'VKO',
        has_afl_flights: true,
    },
    {
        title: {
            ru: 'Шереметьево',
        },
        city_code: 'MOW',
        code: 'SVO',
        has_afl_flights: true,
    },
    {
        title: {
            ru: 'Магадан(Сокол)',
        },
        city_code: 'GDX',
        code: 'GDX',
        has_afl_flights: true,
    },
    {
        title: {
            ru: 'Аэропорт Магас',
        },
        city_code: 'IGT',
        code: 'IGT',
        has_afl_flights: true,
    },
    {
        title: {
            ru: 'Магнитогорск',
        },
        city_code: 'MQF',
        code: 'MQF',
        has_afl_flights: true,
    },
    {
        title: {
            ru: 'Барахас',
        },
        city_code: 'MAD',
        code: 'MAD',
        has_afl_flights: true,
    },
    {
        title: {
            ru: 'Майами',
        },
        city_code: 'MIA',
        code: 'MIA',
        has_afl_flights: true,
    },
    {
        title: {
            ru: 'Малага',
        },
        city_code: 'AGP',
        code: 'AGP',
        has_afl_flights: true,
    },
    {
        title: {
            ru: 'Мале',
        },
        city_code: 'MLE',
        code: 'MLE',
        has_afl_flights: true,
    },
    {
        title: {
            ru: 'Марсель',
        },
        city_code: 'MRS',
        code: 'MRS',
        has_afl_flights: true,
    },
    {
        title: {
            ru: 'Махачкала',
        },
        city_code: 'MCX',
        code: 'MCX',
        has_afl_flights: true,
    },
    {
        title: {
            ru: 'Международный аэропорт Балтимор-Вашингтон',
        },
        city_code: 'BWI',
        code: 'BWI',
        has_afl_flights: true,
    },
    {
        title: {
            ru: 'Международный аэропорт Ричмонд',
        },
        city_code: 'RIC',
        code: 'RIC',
        has_afl_flights: true,
    },
    {
        title: {
            ru: 'Международный аэропорт Маэ Сейшелы',
        },
        city_code: 'SEZ',
        code: 'SEZ',
        has_afl_flights: true,
    },
];

const world_regions = [
    {
        title: {
            ru: 'Россия и страны СНГ',
        },
        world_region_id: 500374,
    },
    {
        title: {
            ru: 'Африка',
        },
        world_region_id: 501656,
    },
    {
        title: {
            ru: 'Ближний восток',
        },
        world_region_id: 1,
    },
    {
        title: {
            ru: 'Европа',
        },
        world_region_id: 3,
    },
    {
        title: {
            ru: 'Азия',
        },
        world_region_id: 2,
    },
    {
        title: {
            ru: 'Америка',
        },
        world_region_id: 4,
    },
];

const countries = [
    {
        title: {
            ru: 'Россия',
        },
        code: 'RU',
        world_region_id: 500374,
    },
    {
        title: {
            ru: 'США',
        },
        code: 'US',
        world_region_id: 4,
    },
    {
        title: {
            ru: 'Сейшелы',
        },
        code: 'SC',
        world_region_id: 501656,
    },
    {
        title: {
            ru: 'Испания',
        },
        code: 'ES',
        world_region_id: 3,
    },
    {
        title: {
            ru: 'Мальдивы',
        },
        code: 'MV',
        world_region_id: 2,
    },
    {
        title: {
            ru: 'Франция',
        },
        code: 'FR',
        world_region_id: 3,
    },
    {
        title: {
            ru: 'Сейшелы',
        },
        code: 'SC',
        world_region_id: 501656,
    },
];

const dictionaries = {
    cities,
    airports,
    world_regions,
    countries,
};

// cities codes:
// [
//      'GDX', 'IGT', 'MQF',
//      'MAD', 'MIA', 'AGP',
//      'MLE', 'MRS', 'MCX',
//      'SEZ', 'MOW', 'BWI',
//      'RIC'
// ];

// airports codes:
// [
//      'VKO', 'SVO', 'GDX',
//      'IGT', 'MQF', 'MAD',
//      'MIA', 'AGP', 'MLE',
//      'MRS', 'MCX', 'BWI',
//      'RIC', 'SEZ'
// ];

// world regions ids: [500374, 501656, 1, 3, 2, 4];

// countries codes: ['RU', 'US', 'SC', 'ES', 'MV', 'FR', 'SC'];

export function getDictionariesServiceMock() {
    const networkService: NetworkService = {
        getDictionary: (dict: string) => {
            return Promise.resolve(dictionaries[dict]);
        },
    } as any;

    const localizationService: LocalizationService = {
        Language: Language.ru,
    } as any;

    const geo: GeoService = {
        getPosition: () => {
            return {
                latitude: 1,
                longitude: 1,
            };
        },
    } as any;

    return new DictionariesService(localizationService, networkService, geo);
}
