<?php


namespace ModulesGarden\Servers\ProxmoxCloudVps\App\UI\Network\Pages;


use ModulesGarden\ProxmoxAddon\App\Services\Cloud\ProductService;
use ModulesGarden\Servers\ProxmoxCloudVps\App\UI\Backup\Pages\BackupDataTable;
use ModulesGarden\Servers\ProxmoxCloudVps\App\UI\Backup\Pages\BackupRawDataTable;
use ModulesGarden\Servers\ProxmoxCloudVps\App\UI\BackupJob\Pages\BackupJobDataTable;
use ModulesGarden\Servers\ProxmoxCloudVps\App\UI\IpAddress\Pages\IpAddressDataTable;
use ModulesGarden\Servers\ProxmoxCloudVps\App\UI\Network\Pages\NetworkLxcDataTable;
use ModulesGarden\Servers\ProxmoxCloudVps\App\UI\Network\Pages\NetworkQemuDataTable;
use ModulesGarden\Servers\ProxmoxCloudVps\App\UI\VirtualInterface\Pages\VirtualInterfaceDataTable;
use ModulesGarden\Servers\ProxmoxCloudVps\Core\UI\Interfaces\ClientArea;
use ModulesGarden\Servers\ProxmoxCloudVps\Core\UI\Widget\TabsWidget\TabsWidget;

class NetworkTab extends TabsWidget implements ClientArea
{
    use ProductService;

    protected $id   = 'networkTab';
    protected $name = 'networkTabName';
    protected $title = 'networkTabTitle';


    public function initContent()
    {
        $this->unsetShowTitle();

        //Public Ips
        /**
         * @deprecated
         * $this->addElement(new IpAddressDataTable());
         */
        //Virtual Network
        if($this->configuration()->isPermissionVirtualNetwork())
        {
            $this->addElement(VirtualInterfaceDataTable::class);
        }

        //Interfaces
        if ($this->configuration()->isQemu() && $this->configuration()->isPermissionNetwork())
        {
            $this->addElement(new NetworkQemuDataTable());
        }
        if ($this->configuration()->isLxc() && $this->configuration()->isPermissionNetwork())
        {
            $this->addElement(new NetworkLxcDataTable());
        }

    }
}