<?php

namespace ModulesGarden\Servers\ZimbraEmail\App\UI\Admin\ProductConfiguration\Pages\Sections;


use ModulesGarden\Servers\ZimbraEmail\App\UI\Admin\Custom\Sections\BoxSectionExtended;
use ModulesGarden\Servers\ZimbraEmail\Core\UI\Interfaces\AdminArea;
use ModulesGarden\Servers\ZimbraEmail\Core\UI\Widget\Forms\Fields\Switcher;
use ModulesGarden\Servers\ZimbraEmail\Core\UI\Widget\Forms\Sections\BoxSection;
use ModulesGarden\Servers\ZimbraEmail\Core\UI\Widget\Forms\Sections\HalfPageSection;

/**
 *
 * Created by PhpStorm.
 * User: Tomasz Bielecki ( tomasz.bi@modulesgarden.com )
 * Date: 29.08.19
 * Time: 08:34
 * Class SearchFeatures
 */
class SearchFeatures  extends BoxSectionExtended implements AdminArea
{
    protected $id       = 'searchFeatures';
    protected $name     = 'searchFeatures';
    protected $title    = 'searchFeatures';

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

    }

    /**
     * @return HalfPageSection
     */
    public function getLeftSection()
    {
        $left = new HalfPageSection('left');

        $field = new Switcher('zimbraFeatureAdvancedSearchEnabled');
        $left->addField($field);

        $field = new Switcher('zimbraFeatureInitialSearchPreferenceEnabled');
        $left->addField($field);

        return $left;
    }

    /**
     * @return HalfPageSection
     */
    public function getRightSection()
    {
        $right = new HalfPageSection('right');

        $field = new Switcher('zimbraFeatureSavedSearchesEnabled');
        $right->addField($field);

        $field = new Switcher('zimbraFeaturePeopleSearchEnabled');
        $right->addField($field);

        return $right;
    }
}