<?php

namespace ModulesGarden\Servers\ProxmoxCloudVps\App\UI\Admin\Product\Sections;

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

class HighAvailabilityClusterSection extends BoxSection implements AdminArea
{
    protected $id = 'highAvailabilityClusterSection';
    protected $name = 'highAvailabilityClusterSection';
    protected $title = 'highAvailabilityClusterSection';
    /**
     * @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()
    {
        //State
        $field = new Select('customconfigoption[clusterState]');
        $field->setDescription('tip');
        $this->leftSection->addField($field);
        //Group
        $field = new Select('customconfigoption[clusterGroup]');
        $field->setDescription('tip');
        $this->rightSection->addField($field);
        //Max. Restart
        $field = new Text('customconfigoption[clusterMaxRestart]');
        $field->setDescription('tip');
        $this->leftSection->addField($field);
        //Max. Relocate
        $field = new Text('customconfigoption[clusterMaxRelocate]');
        $field->setDescription('tip');
        $this->rightSection->addField($field);
    }

}
