<?php
/**
 * Class EditListForm
 * User: Nessandro
 * Date: 2019-10-01
 * Time: 11:25
 * @package ModulesGarden\Servers\ZimbraEmail\App\UI\Client\DistributionList\Forms
 */

namespace ModulesGarden\Servers\ZimbraEmail\App\UI\Client\DistributionList\Forms;


use ModulesGarden\Servers\ZimbraEmail\App\UI\Admin\Custom\Forms\SortedFieldForm;
use ModulesGarden\Servers\ZimbraEmail\App\UI\Client\DistributionList\Providers\EditListDataProvider;
use ModulesGarden\Servers\ZimbraEmail\App\UI\Client\DistributionList\Sections\AddAliasesDistribution;
use ModulesGarden\Servers\ZimbraEmail\App\UI\Client\DistributionList\Sections\AddMembersDistribution;
use ModulesGarden\Servers\ZimbraEmail\App\UI\Client\DistributionList\Sections\AddOwnersDistribution;
use ModulesGarden\Servers\ZimbraEmail\App\UI\Client\DistributionList\Sections\AddPreferencesDistribution;
use ModulesGarden\Servers\ZimbraEmail\App\UI\Client\DistributionList\Sections\AddPropertiesDistribution;
use ModulesGarden\Servers\ZimbraEmail\App\UI\Client\DistributionList\Sections\EditMembersDistribution;
use ModulesGarden\Servers\ZimbraEmail\App\UI\Client\DistributionList\Sections\EditPropertiesDistribution;
use ModulesGarden\Servers\ZimbraEmail\Core\UI\Interfaces\ClientArea;
use ModulesGarden\Servers\ZimbraEmail\Core\UI\Widget\Forms\FormConstants;

class EditListForm extends SortedFieldForm implements ClientArea
{
    protected $id    = 'editListForm';
    protected $name  = 'editListForm';

    public function initContent()
    {
        $this->setFormType(FormConstants::UPDATE);
        $this->setProvider(new EditListDataProvider());
        $this->initFields();
        $this->loadDataToForm();
    }

    protected function initFields()
    {
        $this->addSection(new EditMembersDistribution());
        $this->addSection(new EditPropertiesDistribution());
        $this->addSection(new AddAliasesDistribution());
        $this->addSection(new AddOwnersDistribution());
        $this->addSection(new AddPreferencesDistribution());

    }

    public function reloadFormStructure()
    {

        $this->loadDataToForm();
    }

}