<?php

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

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\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()
    {
        //Storage
        $field = new Select('customconfigoption[storage]');
        $field->setDescription('tip');
        $this->leftSection->addField($field);
        //OS Template
        $field = new Select('customconfigoption[osTemplate]');
        $field->setDescription('tip');
        $this->leftSection->addField($field);
        //CPU Limit
        $field = new Text('customconfigoption[cpulimit]');
        $field->setDescription('tip');
        $this->rightSection->addField($field);
        //Cores
        $field = new Text('customconfigoption[cores]');
        $field->setDescription('tip');
        $this->rightSection->addField($field);
        //SWAP For the VM in MB
        $field = new Text('customconfigoption[swap]');
        $field->setDescription('tip');
        $field->setDefaultValue(512);
        $this->rightSection->addField($field);
        //CPU Weight For The VM
        $field = new Text('customconfigoption[cpuunits]');
        $field->setDescription('tip');
        $field->setDefaultValue(1024);
        $this->leftSection->addField($field);
        //Memory
        $field = new Text('customconfigoption[memory]');
        $field->setDescription('tip');
        $field->setDefaultValue(512);
        $this->leftSection->addField($field);
        //Disk Size
        $field = new Text('customconfigoption[diskSize]');
        $field->setDescription('tip');
        $field->setDefaultValue(32);
        $this->leftSection->addField($field);
        //Additional Disks Size
        $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);
        //snapshotJobs
        $field = new Text('customconfigoption[snapshotJobs]');
        $field->setDescription('tip');
        $field->setDefaultValue(1);
        $this->rightSection->addField($field);
        //randomHostname
        $field = new Switcher('customconfigoption[randomHostname]');
        $field->setDescription('tip');
        $this->rightSection->addField($field);
    }

}
