using System;
using PhilExample.Interfaces;
using PhilExample.UI.Pages;
using PhilExample.Services;
using PhilExampleCrawler.Common.Models;
using Xamarin.Forms;
using Xamarin.Forms.Xaml;

[assembly: ExportFont("Nunito-Bold.ttf", Alias = "NunitoBold")]
[assembly: ExportFont("Nunito-SemiBold.ttf", Alias = "NunitoSemiBold")]
[assembly: ExportFont("Nunito-ExtraBold.ttf", Alias = "NunitoExtraBold")]
[assembly: ExportFont("Nunito-Medium.ttf", Alias = "NunitoMedium")]
namespace PhilExample
{
    public partial class App : Application
    {
        public const string WebAPI_URL = "http://12.345.67.890:62285/";
        public const string TCPSERVER_IP = "192.168.000.00";
        public const int TCPSERVER_PORT = 1234;

        public static UserSession CurrentSession { get; set; }

        public App()
        {
            InitializeComponent();

            DependencyService.RegisterSingleton<IPhExStorage>(new PhExStorage());
            DependencyService.RegisterSingleton<IRESTAccess>(new RESTAccess());
            DependencyService.RegisterSingleton<IUserService>(new UserService());
            DependencyService.RegisterSingleton<ICrawlSessionService>(new CrawlSessionService());
            DependencyService.RegisterSingleton<IExamplePageService>(new ExamplePageService());
            //DependencyService.RegisterSingleton<ICrawlService_SH>(new CrawlService_SH());
            //DependencyService.RegisterSingleton<ICrawlService_CH>(new CrawlService_CH());
            //DependencyService.RegisterSingleton<ITCPClient>(new TCPClient());

            MainPage = new AppShell();
        }

        protected override void OnStart()
        {
        }

        protected override void OnSleep()
        {
        }

        protected override void OnResume()
        {
        }

        public static T GetResource<T>(string key) => (T)App.Current.Resources[key];
    }
}
