using Blahblah.FlowerApp.Controls;
using Blahblah.FlowerApp.Data;
//using CommunityToolkit.Maui;
#if DEBUG
using Microsoft.Extensions.Logging;
#endif

namespace Blahblah.FlowerApp;

public static class MauiProgram
{
    public static MauiApp CreateMauiApp()
    {
        var builder = MauiApp.CreateBuilder();
        builder
            .UseMauiApp<App>()
            //.UseMauiCommunityToolkit()
            .ConfigureFonts(fonts =>
            {
                fonts.AddFont("OpenSans-Regular.ttf", "OpenSansRegular");
                fonts.AddFont("OpenSans-Semibold.ttf", "OpenSansSemibold");
                fonts.AddFont("fa-light-300.ttf", "FontAwesomeLight");
                fonts.AddFont("fa-regular-400.ttf", "FontAwesome");
                fonts.AddFont("fa-solid-900.ttf", "FontAwesomeSolid");
            })
            .ConfigureMauiHandlers(handlers =>
            {
#if IOS
                handlers.AddHandler<OptionEntry, Platforms.iOS.Handlers.OptionEntryHandler>();
                handlers.AddHandler<OptionDatePicker, Platforms.iOS.Handlers.OptionDatePickerHandler>();
                handlers.AddHandler<OptionTimePicker, Platforms.iOS.Handlers.OptionTimePickerHandler>();
#elif ANDROID
                handlers.AddHandler<OptionEntry, Platforms.Android.Handlers.OptionEntryHandler>();
#endif
            });

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

        builder.Services.AddSingleton<HomePage>();
        builder.Services.AddSingleton<SquarePage>();
        builder.Services.AddSingleton<UserPage>();
        builder.Services.AddSingleton<FlowerDatabase>();

        builder.Services.AddLocalization();

        return builder.Build();
    }
}