using CommunityToolkit.Mvvm.DependencyInjection;
using Microsoft.Extensions.DependencyInjection;
using Prise.DependencyInjection;
using Prise.Proxy;
using PSCHelpdesk.Converter;
using PSCHelpdesk.Services;
using PSCHelpdesk.Shared.Service;
using PSCHelpdesk.Shared.Setting;
using PSCHelpdesk.ViewModels;

namespace PSCHelpdesk;

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

        var te = new ServiceCollection()
            .AddSingleton<IUserInterfaceDispatchService, AvaloniaDispatcherService>()
            .AddPrise()
            .AddFactory<IResultConverter>(()=> new AvaloniaPluginResultConverter())
            .AddSingleton<AppService>()
            .AddSingleton<ISettingsManager>(settingsManager)
            .AddSingleton<IMenuService>(menuService)
            .AddSingleton<ISettingsService>(settingsService)
            .AddSingleton<ITestService>(new TestService())
            .AddSingleton<PluginService>()
            .AddTransient<PluginListViewModel>();
            
            
        var ls = te.BuildServiceProvider();
        
        Ioc.Default.ConfigureServices(
            ls
        );
    }
}