using Microsoft.AspNetCore.Components.Web;
using Microsoft.AspNetCore.Components.WebAssembly.Hosting;
using Front;
using System.Globalization;
using Shared.DTOs;
using Front.Services;
using System.ComponentModel.Design;

var builder = WebAssemblyHostBuilder.CreateDefault(args);
builder.RootComponents.Add<App>("#app");
builder.RootComponents.Add<HeadOutlet>("head::after");
builder.Services.AddBlazorBootstrap();

builder.Services.AddScoped<ILocalStorageService, LocalStorageService>();
builder.Services.AddScoped<localService>();
builder.Services.AddScoped<HttpClientController>();
builder.Services.AddScoped<Fixedvalues>();
builder.Services.AddScoped(sp => new UserAuthenticationDTO()
{
    Company = new CompanyAuthenticationDTO()
    {
        ID = 0,
        IsAdmin = false,
        Logo = "",
        Name = ""
    }
    ,
    FullName = "",
    Photo="",
    Token="",
    UserName = "",
    enterDate =new DateTime(),
    exitDate =  new DateTime(),
}) ;


builder.Services.AddScoped(sp => new HttpClient { BaseAddress = new Uri("https://localhost:7075/api/") });

//builder.Services.AddScoped(sp => new HttpClient { BaseAddress = new Uri("http://localhost:5271/api/") });

CultureInfo.DefaultThreadCurrentCulture = new CultureInfo("fa-Ir");

var host = builder.Build();

 
await new MidLevel(
    host.Services.GetRequiredService<ILocalStorageService>(),
        host.Services.GetRequiredService<UserAuthenticationDTO>(),
            host.Services.GetRequiredService<HttpClient>()
    ).InitAsync();

await host.RunAsync();

