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

class ConfigurationSection extends BoxSection implements AdminArea
{
    protected $id = 'configurationSection';
    protected $name = 'configurationSection';
    protected $title = 'configurationSection';
    /**
     * @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()
    {
        //OS Type	- default 2.6/3.x
        $field = new Select('customconfigoption[ostype]');
        $field->setDescription('tip');
        $field->setDefaultValue("l26");
        $this->leftSection->addField($field);
        //ACPI - switch, default off
        $field = new Switcher('customconfigoption[acpi]');
        $field->setDescription('tip');
        $field->setDefaultValue("off");
        $this->rightSection->addField($field);
        //Automatic Restart After Crash
        $field = new Switcher('customconfigoption[autostart]');
        $field->setDescription('tip');
        $this->rightSection->addField($field);
        //cdrom
        $field = new Text('customconfigoption[cdrom]');
        $field->setDescription('tip');
        $this->leftSection->addField($field);
        //CD/DVD-ROM Type
        $field = new Select('customconfigoption[cdromType]');
        $field->setDescription('tip');
        $this->leftSection->addField($field);
        //PCID
        $field = new Switcher('customconfigoption[pcid]');
        $field->setDescription('tip');
        $this->rightSection->addField($field);
        //Numa
        $field = new Switcher('customconfigoption[numa]');
        $field->setDescription('tip');
        $this->leftSection->addField($field);
        //SPEC-CTRL
        $field = new Switcher('customconfigoption[spec-ctrl]');
        $field->setDescription('tip');
        $this->leftSection->addField($field);
        //Startup Freeze CPU
        $field = new Switcher('customconfigoption[freeze]');
        $field->setDescription('tip');
        $this->leftSection->addField($field);
        //Hotplug
        $field = new Select('customconfigoption[hotplug][]');
        $field->setDescription('tip');
        $field->enableMultiple();
        $this->rightSection->addField($field);
        //Keyboard
        $field = new Select('customconfigoption[keyboard]');
        $field->setDescription('tip');
        $this->leftSection->addField($field);
        //KVM Hardware Virtualization
        $field = new Switcher('customconfigoption[kvm]');
        $field->setDescription('tip');
        $field->setDefaultValue("on");
        $this->rightSection->addField($field);
        //Start At Boot
        $field = new Switcher('customconfigoption[onboot]');
        $field->setDescription('tip');
        $this->rightSection->addField($field);
        //Add The VM To The Specific Pool
        $field = new Select('customconfigoption[pool]');
        $field->setDescription('tip');
        $this->leftSection->addField($field);
        //Allow Reboot
        $field = new Switcher('customconfigoption[reboot]');
        $field->setDescription('tip');
        $this->rightSection->addField($field);
        //USB Tablet Device
        $field = new Switcher('customconfigoption[tablet]');
        $field->setDescription('tip');
        $this->rightSection->addField($field);
        //VGA Type
        $field = new Select('customconfigoption[vga]');
        $field->setDescription('tip');
        $this->leftSection->addField($field);
        //Search For Templates In All Nodes
        $field = new Switcher('customconfigoption[osTemplatesInAllNodes]');
        $field->setDescription('tip');
        $field->setDefaultValue("on");
        $this->leftSection->addField($field);
        //Clone Mode
        $field = new Select('customconfigoption[cloneMode]');
        $field->setDescription('tip');
        $field->setDefaultValue("full");
        $this->rightSection->addField($field);
        //Start after created
        $field = new Switcher('customconfigoption[start]');
        $field->setDescription('tip');
        $field->setDefaultValue("on");
        $this->leftSection->addField($field);
        //Clone On The Same Storage As Source
        $field = new Switcher('customconfigoption[cloneOnTheSameStorage]');
        $field->setDescription('tip');
        $this->rightSection->addField($field);
        //md-clear
        $field = new Switcher('customconfigoption[md-clear]');
        $field->setDescription('tip');
        $this->leftSection->addField($field);
        //ssbd
        $field = new Switcher('customconfigoption[ssbd]');
        $field->setDescription('tip');
        $this->rightSection->addField($field);
        //ibpb
        $field = new Switcher('customconfigoption[ibpb]');
        $field->setDescription('tip');
        $this->leftSection->addField($field);
        //virt-ssbd
        $field = new Switcher('customconfigoption[virt-ssbd]');
        $field->setDescription('tip');
        $this->rightSection->addField($field);
        //amd-ssbd
        $field = new Switcher('customconfigoption[amd-ssbd]');
        $field->setDescription('tip');
        $this->leftSection->addField($field);
        //amd-no-ssb
        $field = new Switcher('customconfigoption[amd-no-ssb]');
        $field->setDescription('tip');
        $this->rightSection->addField($field);
        //pdpe1gb
        $field = new Switcher('customconfigoption[pdpe1gb]');
        $field->setDescription('tip');
        $this->rightSection->addField($field);
        //hv-tlbflush
        $field = new Switcher('customconfigoption[hv-tlbflush]');
        $field->setDescription('tip');
        $this->rightSection->addField($field);
        //hv-evmcs
        $field = new Switcher('customconfigoption[hv-evmcs]');
        $field->setDescription('tip');
        $this->rightSection->addField($field);
        //aes
        $field = new Switcher('customconfigoption[aes]');
        $field->setDescription('tip');
        $this->rightSection->addField($field);
        //vgaMemory
        $field = new Text('customconfigoption[vgaMemory]');
        $field->setDescription('tip');
        $this->leftSection->addField($field);
    }

}
