using moadiran;
using moadiran.Data;
using moadiran.Services;
using Shared.DTOs;
using System.Globalization;

var builder = WebApplication.CreateBuilder(args);

// Add services to the container.
builder.Services.AddRazorPages();
builder.Services.AddServerSideBlazor();
builder.Services.AddSingleton<WeatherForecastService>();
builder.Services.AddBlazorBootstrap();




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(),
});

string BaseAddress = builder.Configuration.GetSection("BaseAddress").Value;
builder.Services.AddScoped(sp => new HttpClient { BaseAddress = new Uri(BaseAddress) });

// Server
//builder.Services.AddScoped(sp => new HttpClient { BaseAddress = new Uri("http://195.88.208.142:7075/api/") });
//builder.Services.AddScoped(sp => new HttpClient { BaseAddress = new Uri("http://156.255.1.229:3101:444/api/") });

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

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

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

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.MapBlazorHub();
app.MapFallbackToPage("/_Host");





await app.RunAsync();

