using System.Collections.ObjectModel;
using Avalonia.Controls;
using CommunityToolkit.Mvvm.DependencyInjection;
using CommunityToolkit.Mvvm.Input;
using HetznerCloudApi;
using PSCHelpdesk.Plugins.HetznerServer.Models;
using PSCHelpdesk.Plugins.HetznerServer.Views;
using PSCHelpdesk.Shared.Service;
using PSCHelpdesk.Shared.Setting;
using PSCHelpdesk.Shared.ViewModels;

namespace PSCHelpdesk.Plugins.HetznerServer.ViewModels;

public partial class HetznerSettingsViewModel : ViewModelBase, IViewModelBase
{
    private string _apiKey;
    public HetznerSettingsViewModel()
    {
        
        var settingsManager = (SettingsManager)Ioc.Default.GetService<ISettingsManager>();
        var settings = new Settings();
        settingsManager.LoadPluginSettings("HetznerSettings", settings);
        
        ApiKey = settings.HetznerApiKey;
    }
    
    public string ApiKey
    {
        get => _apiKey;
        set => SetAndRaisePropertyChanged(ref _apiKey, value);
    }
}