using System.Collections;
using System.Collections.Generic;
using UnityEngine;
using YandexQuest.Models;
using Newtonsoft.Json;

public class ClientDataService
{
    public readonly Dictionary<Cities, string> citiesTranslation = new Dictionary<Cities, string>()
    {
        { Cities.MoscowRedRose, "Москва, Красная Роза" },
        { Cities.MoscowCity, "Москва, Москва-Сити" },
        { Cities.MoscowSkolkovo, "Москва, Сколково" },

        { Cities.SaintPetersburg, "Санкт-Петербург" },
        { Cities.Yekaterinburg, "Екатеринбург" },
        { Cities.Novosibirsk, "Новосибирск" },
        { Cities.Kazan, "Казань" },
        { Cities.Innopolis, "Иннополис" },
        { Cities.RostovOnDon, "Ростов-На-Дону" },
        { Cities.NizhnyNovgorod, "Нижний Новгород" },
        { Cities.Simferopol, "Симферополь" },
        { Cities.Vladivostok, "Владивосток" },
        { Cities.Krasnodar, "Краснодар" },
        { Cities.Samara, "Самара" },
        { Cities.Chelyabinsk, "Челябинск" },
        { Cities.Perm, "Пермь" },
        { Cities.Tula, "Тула" },
        { Cities.Sochi, "Сочи" },
        { Cities.Ufa, "Уфа" },
        { Cities.Krasnoyarsk, "Красноярск" },
        { Cities.Tumen, "Тюмень" },
        { Cities.Voronezh, "Воронеж" },

        { Cities.Minsk, "Минск" },
        { Cities.Serbia, "Сербия" }
    };

    public Client data
    {
        get
        {
            var prefsData = PlayerPrefs.GetString("data", string.Empty);
            return prefsData == string.Empty ? null : JsonConvert.DeserializeObject<Client>(prefsData);
        }

        set
        {
            var prefsData = JsonConvert.SerializeObject(value);
            PlayerPrefs.SetString("data", prefsData);
        }
    }

    public int position
    {
        get => PlayerPrefs.GetInt("position", 0);
        set => PlayerPrefs.SetInt("position", value);
    }
}