using CommunityToolkit.Mvvm.DependencyInjection;
using PSCHelpdesk.Plugins.HetznerServer.Service;
using PSCHelpdesk.Plugins.HetznerServer.ViewModels;
using PSCHelpdesk.Plugins.HetznerServer.Views;
using PSCHelpdesk.Shared.Menu;
using PSCHelpdesk.Shared.Plugin;
using PSCHelpdesk.Shared.Service;

namespace PSCHelpdesk.Plugins.HetznerServer;

public class HetznerServer : Contract
{
    public string GetName()
    {
        return "HetznerServerPlugin";
    }

    public void Configure()
    {
        var menuService = Ioc.Default.GetRequiredService<IMenuService>();
        var serverTab = new Item()
        {
            Header = "Server",
            CommandParameter = new ServerViewModel()
        };
        menuService.AddMenuItem(serverTab);
        
        var settingsService = Ioc.Default.GetRequiredService<ISettingsService>();
        var hetznerSettings = new Shared.Setting.Item()
        {
            Header = "Hetzner",
            CommandParameter = new HetznerSettingsViewModel()
        };
        settingsService.AddSetting(hetznerSettings);
    }

    public List<Type> LoadViews()
    {
        return [typeof(ServerView), typeof(HetznerSettingsView)];
    }
    
}