using DxBlazorApplication2.Components;
using DxBlazorApplication2.Services;
using Microsoft.Extensions.DependencyInjection;
using System.Text;

var builder = WebApplication.CreateBuilder(args);
// Alle Codepages aus .NET Framework zu .NET Core hinzufügen
Encoding.RegisterProvider(CodePagesEncodingProvider.Instance);

// Add services to the container.
builder.Services.AddRazorComponents()
    .AddInteractiveServerComponents();

builder.Services.AddDevExpressBlazor(options => {
    options.SizeMode = DevExpress.Blazor.SizeMode.Medium;
});
// Für die Wettervorhersage
builder.Services.AddSingleton<WeatherForecastService>();
// Für den ToDo-Service
builder.Services.AddSingleton<TodoService>();
// Für die Produktion
builder.Services.AddSingleton<DxBlazorApplication2.Services.Produktion.FSTLService>();
builder.Services.AddSingleton<DxBlazorApplication2.Services.Produktion.PSDLService>();
builder.Services.AddSingleton<DxBlazorApplication2.Services.Produktion.BDSTService>();
builder.Services.AddSingleton<DxBlazorApplication2.Services.Produktion.TabellenService>();
builder.Services.AddScoped<DxBlazorApplication2.Services.Produktion.CockpitService>();
// Für den PDF-Viewer
builder.Services.AddDevExpressServerSideBlazorPdfViewer();
builder.Services.AddScoped<DxThemesService>();
builder.Services.AddMvc();

var app = builder.Build();

// Configure the HTTP request pipeline.
if (!app.Environment.IsDevelopment()) {
    app.UseExceptionHandler("/Error", createScopeForErrors: true);
    // The default HSTS value is 30 days. You may want to change this for production scenarios, see https://aka.ms/aspnetcore-hsts.
    app.UseHsts();
}
app.UseHttpsRedirection();

app.UseStaticFiles();
app.UseAntiforgery();

app.MapRazorComponents<App>()
    .AddInteractiveServerRenderMode()
    .AllowAnonymous();

app.Run();