<?php

namespace ModulesGarden\Servers\ProxmoxCloudVps\App\UI\Admin\Product\Sections\Qemu;

use ModulesGarden\ProxmoxAddon\App\Services\Utility;
use ModulesGarden\Servers\ProxmoxCloudVps\App\UI\Admin\Product\Sections\TwiceColumnSection;
use ModulesGarden\Servers\ProxmoxCloudVps\Core\UI\Interfaces\AdminArea;
use ModulesGarden\Servers\ProxmoxCloudVps\Core\UI\Widget\Forms\Fields\Select;
use ModulesGarden\Servers\ProxmoxCloudVps\Core\UI\Widget\Forms\Fields\Switcher;
use ModulesGarden\Servers\ProxmoxCloudVps\Core\UI\Widget\Forms\Fields\Text;

class NetworkSection extends TwiceColumnSection implements AdminArea
{
    protected $id = 'networkSection';
    protected $name = 'networkSection';
    protected $title = 'networkSection';


    protected function initFields()
    {
        //Network Model
        $field = new Select('customconfigoption[networkModel]');
        $field->setDescription('tip');
        $this->addField($field);
        //Bridge
        $field = new Select('customconfigoption[bridge]');
        $field->setDescription('tip');
        $this->addField($field);
        //Network Rate Limit [MB/s]
        $field = new Text('customconfigoption[rate]');
        $field->setDescription('tip');
        $this->addField($field);
        //Minimum Network Rate Limit [MB/s]
        $field = new Text('customconfigoption[minimumRate]');
        $field->setDescription('tip');
        $this->addField($field);
        //Private Bridge
        $field = new Select('customconfigoption[privateBridge]');
        $field->setDescription('tip');
        $this->addField($field);
        //Private Network Model
        $field = new Select('customconfigoption[networkPrivateModel]');
        $field->setDescription('tip');
        $this->addField($field);
        //Disable Additional NIC Creation
        $field = new Switcher('customconfigoption[oneNetworkDevice]');
        $field->setDescription('tip');
        $this->addField($field);
        //Firewall
        $field = new Switcher('customconfigoption[networkFirewall]');
        $field->setDescription('tip');
        $this->addField($field);
        //Multiqueue
        $field = new Text('customconfigoption[queues]');
        $field->setDescription('tip');
        $this->addField($field);
        //VLAN TAG Range From
        $field = new Text('customconfigoption[tagFrom]');
        $field->setDescription('tip');
        $this->addField($field);
        //VLAN TAG Range To
        $field = new Text('customconfigoption[tagTo]');
        $field->setDescription('tip');
        $this->addField($field);
        //Tag
        $field = new Select('customconfigoption[tags][]');
        $field->enableMultiple();
        $field->setDescription('tip');
        if(Utility::isIpManagerProxmoxVPSIntegration()){
            $field->setDescription('ip_manager_integration_tag');
        }
        $this->addField($field);

    }

}
