using CommunityToolkit.Mvvm.DependencyInjection;
using PSCHelpdesk.Shared.Service;
using PSCHelpdesk.Shared.Setting;
using PSCHelpdesk.Shared.ViewModels;

namespace PSCHelpdesk.ViewModels;

public partial class SettingsGlobalViewModel : ViewModelBase, IViewModelBase
{
    private string _globalConfigFilePath;
    private string _sshClientPath;
    private string _sshClientPathArgs;
    private string _scpClientPath;
    private string _scpClientPathArgs;
    private string _privateSSHKeyPath;
    
    public string GlobalConfigFilePath
    {
        get => _globalConfigFilePath;
        set => SetAndRaisePropertyChanged(ref _globalConfigFilePath, value);
    }
    
    public string SshClientPath
    {
        get => _sshClientPath;
        set => SetAndRaisePropertyChanged(ref _sshClientPath, value);
    }
    
    public string ScpClientPath
    {
        get => _scpClientPath;
        set => SetAndRaisePropertyChanged(ref _scpClientPath, value);
    }
    public string SshClientPathArgs
    {
        get => _sshClientPathArgs;
        set => SetAndRaisePropertyChanged(ref _sshClientPathArgs, value);
    }
    
    public string ScpClientPathArgs
    {
        get => _scpClientPathArgs;
        set => SetAndRaisePropertyChanged(ref _scpClientPathArgs, value);
    }
    
    public string PrivateSSHKeyPath
    {
        get => _privateSSHKeyPath;
        set => SetAndRaisePropertyChanged(ref _privateSSHKeyPath, value);
    }
    
    public SettingsGlobalViewModel()
    {
        var settingsManager = new SettingsManager();
        this.GlobalConfigFilePath = settingsManager.CoreSettings.GlobalConfigFilePath;
        this.PrivateSSHKeyPath = settingsManager.CoreSettings.PrivateSSHKeyPath;
        this.ScpClientPath = settingsManager.CoreSettings.SCPClientExecutable;
        this.SshClientPath = settingsManager.CoreSettings.SSHClientExecutable;
        this.SshClientPathArgs = settingsManager.CoreSettings.SSHClientExecutableArgs;
        this.ScpClientPathArgs = settingsManager.CoreSettings.SCPClientExecutableArgs;
    }
    
}