using Microsoft.Extensions.DependencyInjection;
using Microsoft.Extensions.Logging;
using NLog.Extensions.Logging;
using TravelCompanyBusinessLogic.BusinessLogic.OperatorLogics;
using TravelCompanyBusinessLogic.BusinessLogic.TouristLogics;
using TravelCompanyContracts.BusinessLogicsContracts.OperatorBusinessLogicsContracts;
using TravelCompanyContracts.BusinessLogicsContracts.TouristBusinessLogicsContracts;
using TravelCompanyContracts.StoragesContracts.OperatorStoragesContracts;
using TravelCompanyContracts.StoragesContracts.TouristStoragesContracts;
using TravelCompanyDatabaseImplement.Implements;

namespace TravelCompanyView
{
    internal static class Program
    {
        private static ServiceProvider? _serviceProvider;
        public static ServiceProvider? ServiceProvider => _serviceProvider;

        [STAThread]
        static void Main()
        {
            ApplicationConfiguration.Initialize();
            var services = new ServiceCollection();
            ConfigureServices(services);
            _serviceProvider = services.BuildServiceProvider();
            //Application.Run(_serviceProvider.GetRequiredService<Form1>());
        }
        private static void ConfigureServices(ServiceCollection services)
        {
            services.AddLogging(option =>
            {
                option.SetMinimumLevel(LogLevel.Information);
                option.AddNLog("nlog.config");
            });
            services.AddTransient<ITravelStorage, TravelStorage>();
            services.AddTransient<IExcursionStorage, ExcursionStorage>();
            services.AddTransient<IPlaceStorage, PlaceStorage>();
            services.AddTransient<ITouristStorage, TouristStorage>();
            services.AddTransient<ITourStorage, TourStorage>();
            services.AddTransient<IOperatorStorage, OperatorStorage>();
            services.AddTransient<IGuideStorage, GuideStorage>();

            services.AddTransient<ITravelLogic, TravelLogic>();
            services.AddTransient<IExcursionLogic, ExcursionLogic>();
            services.AddTransient<IPlaceLogic, PlaceLogic>();
            services.AddTransient<ITouristLogic, TouristLogic>();
            services.AddTransient<ITourLogic, TourLogic>();
            services.AddTransient<IOperatorLogic, OperatorLogic>();
            services.AddTransient<IGuideLogic, GuideLogic>();
        }
    }
}