using Microsoft.Extensions.Logging;
using TodoList.Maui.Services;
using TodoList.Maui.Services.Platforms;

namespace TodoList.Maui;

public static class MauiProgram
{
	public static MauiApp CreateMauiApp()
	{
		var builder = MauiApp.CreateBuilder();
		builder
			.UseMauiApp<App>()
			.ConfigureFonts(fonts =>
			{
				fonts.AddFont("OpenSans-Regular.ttf", "OpenSansRegular");
				fonts.AddFont("OpenSans-Semibold.ttf", "OpenSansSemibold");
			});

		builder.Services.AddSingleton<IHotKeySettingsService, HotKeySettingsService>();
		builder.Services.AddSingleton<IGlobalHotKeyService>(sp => new NullGlobalHotKeyService());
		builder.Services.AddSingleton<ISystemTrayService>(sp =>
		{
#if WINDOWS
			return new NullSystemTrayService();
#else
			return new NullSystemTrayService();
#endif
		});

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

		return builder.Build();
	}
}
