<?php

namespace ModulesGarden\Servers\ProxmoxVps\App\Helpers;

/*
File:   UrlServiceHelper.php
Date:   15.06.2020
Author: Tomasz Bielecki (tomasz.bi@modulesgarden.com)
Class UrlServiceHelper
*/

use ModulesGarden\ProxmoxAddon\App\Services\Vps\UrlService;
use ModulesGarden\Servers\ProxmoxVps\App\Helpers\BuildUrl;

/**
 * Class UrlServiceHelper
 * @package ModulesGarden\Servers\ProxmoxVps\App\Helpers
 */
class UrlServiceHelper
{

    /**
     * @var \ModulesGarden\ProxmoxAddon\App\Services\Vps\UrlService
     */
    protected $urlService;

    /**
     * UrlServiceHelper constructor.
     */
    public function __construct()
    {
        $this->urlService = new UrlService();
    }

    /**
     * @return string
     */
    public function getXTermConsoleUrl()
    {
        return BuildUrl::isClientArea() ? $this->urlService->getUrl('console', 'xtermjs') : BuildUrl::getSelfUrl().'&mg-action=xtermjs';
    }

    /**
     * @return string
     */
    public function getNoVncConsoleUrl()
    {
        return BuildUrl::isClientArea() ? $this->urlService->getUrl('console', 'novnc') : BuildUrl::getSelfUrl().'&mg-action=novnc';
    }

    /**
     * @return mixed
     */
    public function getSpiceConsoleUrl()
    {
        return $this->urlService->getUrl('console', 'spice');
    }

    public function home()
    {
        return $this->urlService->getUrl();
    }


}