<?php

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

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;
use ModulesGarden\Servers\ProxmoxCloudVps\Core\UI\Widget\Forms\Fields\Textarea;
use ModulesGarden\Servers\ProxmoxCloudVps\Core\UI\Widget\Forms\Sections\BoxSection;
use ModulesGarden\Servers\ProxmoxCloudVps\Core\UI\Widget\Forms\Sections\HalfPageSection;

class AdvancedSection extends BoxSection implements AdminArea
{
    protected $id = 'advancedSection';
    protected $name = 'advancedSection';
    protected $title = 'advancedSection';
    /**
     * @var HalfPageSection
     */
    private $leftSection;
    /**
     * @var HalfPageSection
     */
    private $rightSection;

    public function initContent()
    {
        $this->leftSection  = new HalfPageSection('leftSection');
        $this->rightSection = new HalfPageSection('rightSection');
        $this->addSection($this->leftSection)
            ->addSection($this->rightSection);
        $this->initFields();
    }

    private function initFields()
    {
        //Minimum RAM For The VM
        $field = new Text('customconfigoption[balloon]');
        $field->setDescription('tip');
        $this->leftSection->addField($field);
        //Memory Shares
        $field = new Text('customconfigoption[shares]');
        $field->setDescription('tip');
        $this->rightSection->addField($field);
        //Arguments-
        $field = new Textarea('customconfigoption[args]');
        $field->setDescription('tip');
        $this->leftSection->addField($field);
        //Local Time For Real Time Clock
        $field = new Switcher('customconfigoption[localtime]');
        $field->setDescription('tip');
        $this->rightSection->addField($field);
        //Maximum Tolerated Downtime
        $field = new Text('customconfigoption[migrate_downtime]');
        $field->setDescription('tip');
        $this->rightSection->addField($field);
        //Maximum Speed For Migrations [MB/s]
        $field = new Text('customconfigoption[migrate_speed]');
        $field->setDescription('tip');
        $this->leftSection->addField($field);
        //Hardware Watchdog Device
        $field = new Text('customconfigoption[watchdog]');
        $field->setDescription('tip');
        $this->rightSection->addField($field);
        //Initial Date Of The Real Time Clock
        $field = new Text('customconfigoption[startdate]');
        $field->setDescription('tip');
        $this->leftSection->addField($field);
        //Startup
        $field = new Text('customconfigoption[startup]');
        $field->setDescription('tip');
        $this->rightSection->addField($field);
        //Time Drift Fix
        $field = new Switcher('customconfigoption[tdf]');
        $field->setDescription('tip');
        $this->leftSection->addField($field);
        //bwlimit
        $field = new Text('customconfigoption[bwlimit]');
        $field->setDescription('tip');
        $this->rightSection->addField($field);
        //bios
        $field = new Select('customconfigoption[bios]');
        $field->setDescription('tip');
        $this->rightSection->addField($field);
        //machine
        $field = new Select('customconfigoption[machine]');
        $field->setDescription('tip');
        $this->leftSection->addField($field);
    }

}
