using Microsoft.Extensions.DependencyInjection;
using Microsoft.Extensions.Hosting;
using Microsoft.Extensions.Configuration;
using BLL;
using DAL;


namespace Integracion_DGA
{
    class Program
    {
        static async Task Main(string[] args)
        {
            using IHost host = Host.CreateDefaultBuilder(args)
                .ConfigureServices((context, services) =>
                {
                    IConfiguration configuration = context.Configuration;
                    services.AddSingleton<IConfiguration>(configuration);

                    // Inyectar tus servicios personalizados
                    services.AddScoped<MedicionScadaRepository>();
                    services.AddScoped<EnvioDGA>();
                })
                .Build();

            var envioDGA = host.Services.GetRequiredService<EnvioDGA>();
            var mediciones = await envioDGA.ObtenerMedicionesAsync();

            Console.WriteLine($"Se obtuvieron {mediciones.Count} registros.");
        }
    }
}
