<?php

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

use ModulesGarden\Servers\ProxmoxVps\Core\UI\Interfaces\AdminArea;
use ModulesGarden\Servers\ProxmoxVps\Core\UI\Widget\Forms\Fields\Select;
use ModulesGarden\Servers\ProxmoxVps\Core\UI\Widget\Forms\Fields\Switcher;
use ModulesGarden\Servers\ProxmoxVps\Core\UI\Widget\Forms\Sections\BoxSection;
use ModulesGarden\Servers\ProxmoxVps\Core\UI\Widget\Forms\Sections\HalfPageSection;

class AdditonalDisk extends BoxSection implements AdminArea
{
    protected $id = 'additonalDisk';
    protected $name = 'additonalDisk';
    protected $title = 'additonalDisk';
    /**
     * @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()
    {
        //Disks Storage
        $field = new Select('customconfigoption[additionalDiskStorage]');
        $field->setDefaultValue('local-lvm');
        $field->setDescription('tip');
        $this->leftSection->addField($field);
        //Disks Type
        $field = new Select('customconfigoption[additionalDiskType][]');
        $field->setDescription('tip');
        $field->enableMultiple();
        $field->setDefaultValue(["ide"]);
        $this->rightSection->addField($field);
        //Disk Format
        $field = new Select('customconfigoption[additionalDiskFormat][]');
        $field->enableMultiple();
        $field->setDefaultValue(["raw"]);
        $field->setDescription('tip');
        $this->leftSection->addField($field);
        //Disk Skip Replication
        $field = new Switcher('customconfigoption[additionalDiskReplicate]');
        $field->setDescription('tip');
        $this->rightSection->addField($field);
        //Disk Cache
        $field = new Select('customconfigoption[additionalDiskCache]');
        $field->setDescription('tip');
        $this->leftSection->addField($field);
        //Disk Discard
        $field = new Switcher('customconfigoption[additionalDiskDiscard]');
        $field->setDescription('tip');
        $this->rightSection->addField($field);
        //Disk IO Thread
        $field = new Switcher('customconfigoption[additionalDiskIoThread]');
        $field->setDescription('tip');
        $this->leftSection->addField($field);
        //Allow Backups On Additional Disks
        $field = new Switcher('customconfigoption[permissionAdditionalDiskBackup]');
        $field->setDescription('tip');
        $this->rightSection->addField($field);
        //Limits
        $field = new Switcher('customconfigoption[additionalDiskSpeed]');
        $field->setDescription('tip');
        $this->leftSection->addField($field);
        //ssd
        $field = new Switcher('customconfigoption[additionalDiskSsd]');
        $field->setDescription('tip');
        $this->rightSection->addField($field);
        //additionalDisk
        $field = new Switcher('customconfigoption[additionalDisk]');
        $field->setDescription('tip');
        $this->rightSection->addField($field);

    }

}
