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

class MountPointSection extends BoxSection implements AdminArea
{
    protected $id = 'mountPointSection';
    protected $name = 'mountPointSection';
    protected $title = 'mountPointSection';
    /**
     * @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[mountPointStorage]');
        $field->setDefaultValue('local-lvm');
        $field->setDescription('tip');
        $this->leftSection->addField($field);
        //ACLs
        $field = new Select('customconfigoption[mountPointAcl]');
        $field->setDefaultValue("default");
        $field->setDescription('tip');
        $this->rightSection->addField($field);
        //Read-Only
        $field = new Switcher('customconfigoption[mountPointRo]');
        $field->setDescription('tip');
        $this->leftSection->addField($field);
        //Enable Quota
        $field = new Switcher('customconfigoption[mountPointQuota]');
        $field->setDescription('tip');
        $this->rightSection->addField($field);
        //Skip Replication
        $field = new Switcher('customconfigoption[mountPointReplicate]');
        $field->setDescription('tip');
        $this->leftSection->addField($field);
        //permissionMountPointBackup
        $field = new Switcher('customconfigoption[permissionMountPointBackup]');
        $field->setDescription('tip');
        $field->setDefaultValue("on");
        $this->rightSection->addField($field);
        //mountPoint
        $field = new Switcher('customconfigoption[mountPoint]');
        $field->setDescription('tip');
        $this->leftSection->addField($field);
    }

}
