using FSI.BT.IR.Plc.Settings.Log;
using FSI.BT.IR.Plc.Settings.Log.Data;
using Microsoft.EntityFrameworkCore;
using static FSI.BT.IR.Plc.Settings.Log.Settings.Context;

var builder = Host.CreateApplicationBuilder(args);

builder.Services.AddHostedService<Worker>();
builder.Services.AddSingleton<ISettings, FSI.BT.IR.Plc.Settings.Log.Settings.AppContext>();

var connectionString = builder.Configuration.GetConnectionString("DefaultConnection") ?? throw new InvalidOperationException("Connection string 'DefaultConnection' not found.");
builder.Services.AddDbContext<ApplicationDbContext>(options =>
    options.UseSqlite(connectionString));



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