using AntDesign.ProLayout;
using Microsoft.AspNetCore.Components.Authorization;
using Microsoft.AspNetCore.Components.WebAssembly.Hosting;
using Microsoft.Extensions.DependencyInjection;
using System;
using System.Net.Http;
using System.Threading.Tasks;

namespace wispro.sp.webclient
{
    public class Program
    {
        public static async Task Main(string[] args)
        {
            var builder = WebAssemblyHostBuilder.CreateDefault(args);
            builder.RootComponents.Add<App>("#app");

            builder.Services.AddScoped(sp => new HttpClient { BaseAddress = new Uri(builder.HostEnvironment.BaseAddress) });
            builder.Services.AddAntDesign();
            builder.Services.Configure<ProSettings>(x=> {
                x.Title = "深圳威世博绩效系统";
                x.NavTheme = "light";
                x.Layout = "mix";
                x.ContentWidth = "Fluid";
                x.FixedHeader = false;
                x.PrimaryColor = "sunset";
                x.ColorWeak = false;
                x.SplitMenus = false;
                x.HeaderRender = true;
                x.FooterRender = true;
                x.MenuRender = true;
                x.MenuHeaderRender = true;
                x.HeaderHeight = 48;
            });
            builder.Services.AddScoped<AuthenticationStateProvider, AuthProvider>();
            builder.Services.AddAuthorizationCore(option =>
            {
                option.AddPolicy("Admin", policy => policy.RequireClaim("Admin"));
            });
            await builder.Build().RunAsync();
        }
    }
}