using IntegryApiClient.Blazor;
using Template.Web.Components;
using Template.Shared.Interfaces;
using Template.Web.Services;

#if DEBUG
const string BaseRestServicesEndpoint = "https://devservices.studioml.it/ems-api/";
//const string BaseRestServicesEndpoint = "http://192.168.2.23:8080/ems-api/";
#else
    const string BaseRestServicesEndpoint = "https://services.studioml.it/ems-api/";
#endif

var builder = WebApplication.CreateBuilder(args);

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

builder.Services.AddBlazorBootstrap();
builder.Services.UseIntegry(BaseRestServicesEndpoint);

builder.Services.AddScoped<IFormFactor, FormFactor>();

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()
    .AddAdditionalAssemblies(typeof(Template.Shared._Imports).Assembly);

app.Run();
