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

class DiskSection extends BoxSection implements AdminArea
{
    protected $id = 'diskSection';
    protected $name = 'diskSection';
    protected $title = 'diskSection';
    /**
     * @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()
    {
        //Storage
        $field = new Select('customconfigoption[diskStorage]');
        $field->setDescription('tip');
        $field->setDefaultValue('local-lvm');
        $this->leftSection->addField($field);
        //Disk Type
        $field = new Select('customconfigoption[diskType]');
        $field->setDescription('tip');
        $this->rightSection->addField($field);
        //Disk Format
        $field = new Select('customconfigoption[diskFormat]');
        $field->setDescription('tip');
        $this->leftSection->addField($field);
        //Cache
        $field = new Select('customconfigoption[diskCache]');
        $field->setDescription('tip');
        $this->rightSection->addField($field);
        //SCSI Controller Model
        $field = new Select('customconfigoption[scsihw]');
        $field->setDescription('tip');
        $this->leftSection->addField($field);
        //Discard
        $field = new Switcher('customconfigoption[discard]');
        $field->setDescription('tip');
        $this->rightSection->addField($field);
        //Skip Replication
        $field = new Switcher('customconfigoption[replicate]');
        $field->setDescription('tip');
        $this->leftSection->addField($field);
        //IO Thread
        $field = new Switcher('customconfigoption[ioThread]');
        $field->setDescription('tip');
        $this->rightSection->addField($field);
        //Limits
        $field = new Switcher('customconfigoption[diskSpeed]');
        $field->setDescription('tip');
        $this->leftSection->addField($field);
        //ssd
        $field = new Switcher('customconfigoption[ssd]');
        $field->setDescription('tip');
        $this->rightSection->addField($field);
    }

}
