using FabApprovalWorkerService.Workers;

using Microsoft.Extensions.Configuration;
using NLog.Extensions.Logging;

using System.Data.SqlClient;

using System.Data;
using FabApprovalWorkerService.Services;

IHostBuilder builder = Host.CreateDefaultBuilder(args)
    .ConfigureLogging((hostContext, logging) => {
        logging.ClearProviders();
        logging.SetMinimumLevel(LogLevel.Trace);
        logging.AddNLog();
    })
    .ConfigureServices((hostContext, services) => {
        services.AddHostedService<UserCertificationUpdateWorker>();
        services.AddTransient<IDbConnection>(db => new SqlConnection(
                    hostContext.Configuration.GetConnectionString("Default")));
        services.AddScoped<IDalService, DalService>();
        services.AddScoped<IUserService, UserService>();
    });

IHost host = builder.Build();
host.Run();
