// See https://aka.ms/new-console-template for more information
using Forwarder.Data;

using GeoRitmMover.GeoRitm.Data;
using GeoRitmMover.Mover.Data;

using Microsoft.EntityFrameworkCore;
using Microsoft.Extensions.DependencyInjection;
using Microsoft.Extensions.Hosting;
using Microsoft.Extensions.Logging;

Console.WriteLine("Hello, World!");

var host = Host.CreateDefaultBuilder(args)
	.ConfigureServices(services =>
	{
		//services.AddHostedService<ContactIDGrabber>();
		_ = services.AddHostedService<Worker>();

		var forwarderConnectionString = "***";
		_ = services.AddDbContext<IDataContext, DataContext>(options =>
		{
			_ = options.UseNpgsql(forwarderConnectionString)
				.UseLoggerFactory(LoggerFactory.Create(x => x.SetMinimumLevel(LogLevel.Warning)));
			_ = options.EnableSensitiveDataLogging(false);
		});

		var moverConnectionString = "***";
		_ = services.AddDbContext<MoverDbContext>(options =>
		{
			_ = options.UseNpgsql(moverConnectionString)
				.EnableSensitiveDataLogging(false);
		});

		var georitmConnectionString = "***";
		_ = services.AddDbContext<GeoRitmDbContext>(options =>
		{
			_ = options.UseMySQL(georitmConnectionString)
				.EnableSensitiveDataLogging(false);
		});
	})
	.Build();

await host.RunAsync();
