using CommunityToolkit.Mvvm.DependencyInjection;
using Microsoft.Extensions.DependencyInjection;
using PSCHelpdesk.Services;
using PSCHelpdesk.Shared.Service;
using PSCHelpdesk.Shared.Setting;
using PSCHelpdesk.Shared.Tasks;
using PSCHelpdesk.Tasks;
using PSCHelpdesk.Toasts;
using PSCHelpdesk.Toasts.Display;
using PSCHelpdesk.ViewModels;

namespace PSCHelpdesk;

class Startup
{
    public static void RegisterServices()
    {
        var menuService = new MenuService();
        var settingsManager = new SettingsManager();
        var settingsService = new SettingsService();
        var taskManager = new TaskManager();
        var toastManager = new ToastManager();

        var te = new ServiceCollection()
            .AddSingleton<IUserInterfaceDispatchService, AvaloniaDispatcherService>()
            .AddSingleton<AppService>()
            .AddSingleton<ISettingsManager>(settingsManager)
            .AddSingleton<ISettingsService>(settingsService)
            .AddSingleton<ITaskManager>(taskManager)
            .AddSingleton<IMenuService>(menuService)
            .AddSingleton<ITestService>(new TestService())
            .AddSingleton<PluginManager>()
            .AddSingleton<IToastManager>(toastManager)
            .AddTransient<PluginListViewModel>();
            
            
        var ls = te.BuildServiceProvider();
        
        Ioc.Default.ConfigureServices(
            ls
        );
    }
}