using MyBookmark.UI.RazorPages.Clients.Library.Genre;
using MyBookmark.UI.RazorPages.Clients.Library.Language;
using MyBookmark.UI.RazorPages.Clients.Library.MediaContent.Anime.Title;

var builder = WebApplication.CreateBuilder(args);

// Add services to the container.
builder.Services.AddRazorPages();
var u = builder.Configuration.GetValue<string>("ClientUrls:Library") ?? throw new Exception("n");
builder.Services.AddHttpClient<ILanguageClient, LanguageClient>()
            .ConfigureHttpClient(q => q.BaseAddress = new Uri(u));
builder.Services.AddHttpClient<IGenreClient, GenreClient>()
            .ConfigureHttpClient(q => q.BaseAddress = new Uri(u));
builder.Services.AddHttpClient<ITitleClient, TitleClient>()
            .ConfigureHttpClient(q => q.BaseAddress = new Uri(u));

var app = builder.Build();

// Configure the HTTP request pipeline.
if (!app.Environment.IsDevelopment())
{
    app.UseExceptionHandler("/Error");
    // 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.UseRouting();

app.UseAuthorization();

app.MapRazorPages();

app.Run();
