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

class ContainerSection extends BoxSection implements AdminArea
{
    protected $id = 'containerSection';
    protected $name = 'containerSection';
    protected $title = 'containerSection';
    /**
     * @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()
    {
        //VM Template
        $field = new Select('customconfigoption[osTemplate]');
        $field->setDescription('tip');
        $this->leftSection->addField($field);
        //ISO Image
        $field = new Select('customconfigoption[isoImage]');
        $field->setDescription('tip');
        $this->rightSection->addField($field);
        //cpu
        $field = new Select('customconfigoption[cpu]');
        $field->setDescription('tip');
        $field->setDefaultValue('kvm64');
        $this->leftSection->addField($field);
        //Number of CPU Sockets
        $field = new Text('customconfigoption[sockets]');
        $field->setDescription('tip');
        $field->setDefaultValue(1);
        $this->leftSection->addField($field);
        //Number of Cores Per Socket
        $field = new Text('customconfigoption[cores]');
        $field->setDefaultValue(1);
        $field->setDescription('tip');
        $this->rightSection->addField($field);
        //VCPUs
        $field = new Text('customconfigoption[vcpus]');
        $field->setDefaultValue(1);
        $field->setDescription('tip');
        $this->leftSection->addField($field);
        //Limit of CPU
        $field = new Text('customconfigoption[cpulimit]');
        $field->setDescription('tip');
        $this->rightSection->addField($field);
        //CPU Weight For The VM
        $field = new Text('customconfigoption[cpuunits]');
        $field->setDescription('tip');
        $this->leftSection->addField($field);
        //RAM For The VM
        $field = new Text('customconfigoption[memory]');
        $field->setDescription('tip');
        $this->leftSection->addField($field);
        //Disk Space
        $field = new Text('customconfigoption[diskSize]');
        $field->setDescription('tip');
        $field->setDefaultValue(32);
        $this->rightSection->addField($field);
        //Additional Disks Space
        $field = new Text('customconfigoption[additionalDiskSize]');
        $field->setDescription('tip');
        $this->leftSection->addField($field);
        //Network Rate Limit
        $field = new Text('customconfigoption[rate]');
        $field->setDescription('tip');
        $this->rightSection->addField($field);
        //Minimum Network Rate Limit
        $field = new Text('customconfigoption[minimumRate]');
        $field->setDescription('tip');
        $this->leftSection->addField($field);
        //Amount of IPv4 Addresses
        $field = new Text('customconfigoption[ipv4]');
        $field->setDescription('tip');
        $this->rightSection->addField($field);
        //Amount of IPv6 Addresses
        $field = new Text('customconfigoption[ipv6]');
        $field->setDescription('tip');
        $this->leftSection->addField($field);
        //Backups Size Limit
        $field = new Text('customconfigoption[backupMaxSize]');
        $field->setDescription('tip');
        $this->rightSection->addField($field);
        //Backup Files Limit
        $field = new Text('customconfigoption[backupMaxFiles]');
        $field->setDescription('tip');
        $this->leftSection->addField($field);
        //Bandwidth Limit
        $field = new Text('customconfigoption[bandwidth]');
        $field->setDescription('tip');
        $this->rightSection->addField($field);
        //Snapshots Limit
        $field = new Text('customconfigoption[snapshotMaxFiles]');
        $field->setDescription('tip');
        $this->rightSection->addField($field);
        //Snapshot Jobs
        $field = new Text('customconfigoption[snapshotJobs]');
        $field->setDescription('tip');
        $field->setDefaultValue(1);
        $this->rightSection->addField($field);
    }

}
