<?php

/* * ********************************************************************
 * ProxmoxAddon product developed. (Sep 12, 2018)
 * *
 *
 *  CREATED BY MODULESGARDEN       ->       http://modulesgarden.com
 *  CONTACT                        ->       contact@modulesgarden.com
 *
 *
 * This software is furnished under a license and may be used and copied
 * only  in  accordance  with  the  terms  of such  license and with the
 * inclusion of the above copyright notice.  This software  or any other
 * copies thereof may not be provided or otherwise made available to any
 * other person.  No title to and  ownership of the  software is  hereby
 * transferred.
 *
 *
 * ******************************************************************** */

namespace ModulesGarden\ProxmoxAddon\App\UI\ServerSettings\Sections;


use ModulesGarden\ProxmoxAddon\App\UI\Validators\NumberValidator;
use ModulesGarden\ProxmoxAddon\Core\UI\Widget\Forms\Fields\Hidden;
use ModulesGarden\ProxmoxAddon\Core\UI\Widget\Forms\Fields\Select;
use ModulesGarden\ProxmoxAddon\Core\UI\Widget\Forms\Fields\Text;
use ModulesGarden\ProxmoxAddon\Core\UI\Widget\Forms\Fields\Textarea;
use ModulesGarden\ProxmoxAddon\Core\UI\Widget\Forms\Sections\BoxSection;
use ModulesGarden\ProxmoxAddon\Core\UI\Widget\Forms\Sections\HalfPageSection;
use ModulesGarden\ProxmoxAddon\Core\UI\Widget\Forms\Sections\RawSection;

/**
 * Description of CronSection
 *
 * @author Pawel Kopec <pawelk@modulesgardne.com>
 */
class GeneralSection extends BoxSection
{

    protected $id   = 'generalSection';
    protected $name = 'generalSection';
    protected $title = 'generalSectionTitle';
    public function initContent()
    {
        //Add Sections
        $leftSection  = new HalfPageSection('leftSection');
        $rightSection = new HalfPageSection('rightSection');
        $this->addSection($leftSection);
        $this->addSection($rightSection);
        $bottomSection = new RawSection('bottomSection');
        $this->addSection($bottomSection);
        //server_id
        $field = new Hidden('server_id');
        $leftSection->addField($field);
        //VMID From
        $field = new Text('vmid_from');
        $field->setDescription('description');
        $field->addValidator(new NumberValidator());
        $leftSection->addField($field);
        //VMID To
        $field = new Text('vmid_to');
        $field->setDescription('description');
        $field->addValidator(new NumberValidator());
        $rightSection->addField($field);
        //sshHost
        $field = new Text('sshHost');
        $leftSection->addField($field);
        //sshPort
        $field = new Text('sshPort');
        $rightSection->addField($field);
        //sshUser
        $field = new Text('sshUser');
        $leftSection->addField($field);
        //sshPassword
        $field = new Text('sshPassword');
        $rightSection->addField($field);
        //sshKey
        $field = new Textarea('sshKey');
        $bottomSection->addField($field);
        //snippetStorage
        $field = new Select('snippetStorage');
        $bottomSection->addField($field);
    }
}
