<?php
namespace ModulesGarden\Servers\OpenXchange\App\UI\Admin\ProductConfiguration\Pages\Sections;
use ModulesGarden\Servers\OpenXchange\App\Enums\Size;
use ModulesGarden\Servers\OpenXchange\Core\UI\Interfaces\AdminArea;
use ModulesGarden\Servers\OpenXchange\Core\UI\Widget\Forms\Fields\Text;
use ModulesGarden\Servers\OpenXchange\Core\UI\Widget\Forms\Fields\Select;
use ModulesGarden\Servers\OpenXchange\Core\UI\Widget\Forms\Fields\Switcher;
use ModulesGarden\Servers\OpenXchange\Core\UI\Widget\Forms\Sections\BoxSection;
use ModulesGarden\Servers\OpenXchange\Core\UI\Widget\Forms\Sections\HalfPageSection;
use ModulesGarden\Servers\OpenXchange\App\UI\Client\Others\Fields\ExtendedInputField;
use ModulesGarden\Servers\OpenXchange\App\UI\Client\Others\Sections\BoxSectionExtended;

/**
 *
 * Created by PhpStorm.
 * User: Tomasz Bielecki ( tomasz.bi@modulesgarden.com )
 * Date: 28.08.19
 * Time: 09:15
 * Class ZimbraSettingsSection
 */
class ProductSettings extends BoxSectionExtended implements AdminArea
{
    protected $id       = 'oxSettings';
    protected $name     = 'oxSettings';
    protected $title    = 'oxSettings';

    public function initContent()
    {
        $this
            ->addSection($this->getLeftSection())
            ->addSection($this->getRightSection());

    }

    /**
     * @description left section
     * @return HalfPageSection
     */
    public function getLeftSection()
    {
        $leftSection = new HalfPageSection('leftSide');
        
        //packages dropdown
        $field = new Select('selected_product');
        $field->setDescription('description');
        $leftSection->addField($field);

        $field = new ExtendedInputField('email_accounts_productivity');
        $field->setFieldType(ExtendedInputField::TYPE_NUMBER);
        $field->setDescription('description');
        $leftSection->addField($field);
        
        $field = new ExtendedInputField('email_accounts_productivity_security');
        $field->setFieldType(ExtendedInputField::TYPE_NUMBER);
        $field->setDescription('description');
        $leftSection->addField($field);

        /*$field = new Select('module_access');
        $field->setDescription('description');
        $leftSection->addField($field);*/

        $field = new ExtendedInputField('user_quota');
        $field->setFieldType(ExtendedInputField::TYPE_NUMBER);
        $field->setDescription('description');
        $leftSection->addField($field);

        $field = new ExtendedInputField('quota');
        $field->setFieldType(ExtendedInputField::TYPE_NUMBER);
        $field->setDescription('description');
        $leftSection->addField($field);
        
        $field = new ExtendedInputField('free_mailboxes');
        $field->setFieldType(ExtendedInputField::TYPE_NUMBER);
        $field->setDescription('description');
        $leftSection->addField($field);

        $field = new Switcher('own_domains');
        $field->setDescription('description');
        $leftSection->addField($field);

        $field = new Switcher('allow_to_change_password');
        $field->setDescription('description');
        $leftSection->addField($field);

        $field = new Switcher('show_catch_all_button');
        $field->setDescription('description');
        $leftSection->addField($field);

        return $leftSection;

    }

    /**
     * @description right section
     * @return HalfPageSection
     */
    public function getRightSection()
    {
        $right = new HalfPageSection('rightSide');
        
        //amount of allowed accounts for selected product
        $field = new ExtendedInputField('product_accounts');
        $field->setFieldType(ExtendedInputField::TYPE_NUMBER);
        $field->setDescription('description');
        $right->addField($field);

        $field = new ExtendedInputField('email_accounts_security');
        $field->setFieldType(ExtendedInputField::TYPE_NUMBER);
        $field->setDescription('description');
        $right->addField($field);
        
        $field = new ExtendedInputField('email_accounts_guard');
        $field->setFieldType(ExtendedInputField::TYPE_NUMBER);
        $field->setDescription('description');
        $right->addField($field);
        
        $field = new ExtendedInputField('email_accounts_ai');
        $field->setFieldType(ExtendedInputField::TYPE_NUMBER);
        $field->setDescription('description');
        $right->addField($field);

        $field = new ExtendedInputField('alias_limit');
        $field->setFieldType(ExtendedInputField::TYPE_NUMBER);
        $field->setDescription('description');
        $right->addField($field);

        $field = new ExtendedInputField('forwarding_alias_limit');
        $field->setFieldType(ExtendedInputField::TYPE_NUMBER);
        $field->setDescription('description');
        $right->addField($field);

        return $right;
    }
}