using IntegryApiClient.MAUI;
using Microsoft.Extensions.Logging;
using Fixiy.Maui.Services;
using Fixiy.Shared;
using Fixiy.Shared.Interfaces;

namespace Fixiy.Maui
{
    public static class MauiProgram
    {
        private const string AppToken = "3e7e7147-1391-48e7-86bd-b70e7418d40d";
        
        public static MauiApp CreateMauiApp()
        {
            InteractiveRenderSettings.ConfigureBlazorHybridRenderModes();

            var builder = MauiApp.CreateBuilder();
            builder
                .UseMauiApp<App>()
                .UseIntegry(appToken: AppToken, useLoginAzienda: true)
                .ConfigureFonts(fonts =>
                {
                    fonts.AddFont("OpenSans-Regular.ttf", "OpenSansRegular");
                });

            builder.Services.AddMauiBlazorWebView();

#if DEBUG
            builder.Services.AddBlazorWebViewDeveloperTools();
    		builder.Logging.AddDebug();
#endif

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

            return builder.Build();
        }
    }
}
