<?php
namespace ModulesGarden\Servers\ProxmoxVps\App\UI\Resources\Pages;

use ModulesGarden\Servers\ProxmoxVps\App\UI\Resources\Providers\BackupResourceProvider;
use ModulesGarden\Servers\ProxmoxVps\Core\UI\Builder\BaseContainer;
use ModulesGarden\Servers\ProxmoxVps\Core\UI\Interfaces\AjaxElementInterface;
use ModulesGarden\Servers\ProxmoxVps\Core\UI\Interfaces\ClientArea;
use ModulesGarden\Servers\ProxmoxVps\Core\UI\ResponseTemplates\RawDataJsonResponse;

class ResourcesContainer extends BaseContainer implements ClientArea, AjaxElementInterface
{
    protected $id = 'resourcesContainer';
    protected $title = 'resourcesContainer';
    protected $vueComponent = true;
    protected $defaultVueComponentName = 'mg-resourcesContainer';

    public function initContent()
    {
        $this->provider = new BackupResourceProvider();
    }

    public function prepareAjaxData()
    {

        return $this->provider->read();
    }

    public function returnAjaxData()
    {
        return new RawDataJsonResponse(['data' => $this->prepareAjaxData()]);
    }
}