<?php

namespace ModulesGarden\ProxmoxAddon\App\UI\NodeDetail\Pages;

use MGProvision\Proxmox\v2 as proxmox;

trait LoadAPIData
{

    use \ModulesGarden\ProxmoxAddon\Core\UI\Traits\RequestObjectHandler;
    use \ModulesGarden\ProxmoxAddon\App\Services\BaseService;

    protected $timeframe = "week";

    public function loadApiData()
    {
        $this->setServerId($this->getRequestValue('serverId'))
            ->getApi()
            ->setInstance();
        $data = [];

        $request = [
            "timeframe" => $this->timeframe,
            "cf"        => "MAX",
        ];
        $node    = new proxmox\models\Node($this->getRequestValue('id'));
        $rrdata  = $node->rrdData($request);
        return $rrdata;
    }
}
