using Nexus.Api.Extensions;

var builder = WebApplication.CreateBuilder(args);

// --- Service Registration ---
builder.Services.AddNexusAuth(builder.Configuration);
builder.Services.AddNexusRateLimiting();
builder.Services.AddNexusForwardedHeaders();
builder.Services.AddNexusSwagger();
builder.Services.AddNexusDatabase(builder.Configuration);
builder.Services.AddNexusHttpClients(builder.Configuration);
builder.Services.AddNexusApplicationServices();
builder.Services.AddNexusRepositories();
builder.Services.AddNexusHealthChecks(builder.Configuration);
builder.Services.AddControllers();

var app = builder.Build();

// --- Database Migration & Seeding ---
await app.EnsureDatabaseAsync();

// --- Middleware Pipeline ---
app.UseNexusPipeline(app.Environment);

app.MapControllers();
app.Run();
