<?php


namespace ModulesGarden\ProxmoxAddon\App\Repositories;

/**
 * Class ServerConfigurationRepository
 * @package ModulesGarden\ProxmoxAddon\App\Repositories
 * @property $sshHost
 * @property $sshPort
 * @property $sshUser
 * @property $snippetStorage
 * @property $snippetDirectory
 */
class ServerConfigurationRepository extends  AbstractServerConfigurationRepository
{

    public function __get($name)
    {
        return  $this->get($name);
    }

    /**
     * @return mixed
     */
    public function getSshPassword()
    {
        return  html_entity_decode(decrypt($this->sshPassword), ENT_QUOTES);
    }

    public function getSshKey()
    {
        return decrypt($this->sshKey);
    }

    public function hasSshKey()
    {
        return decrypt($this->sshKey) !="";
    }

    /**
     * @param mixed $sshPassword
     * @return ServerConfigurationRepository
     */
    public function setSshPassword($sshPassword)
    {
        $this->set('sshPassword',encrypt($sshPassword));
        return $this;
    }


}
