<?php
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\AddListDataProvider;
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\EmailAccount\Providers\AccountDataProvider;
use ModulesGarden\Servers\ZimbraEmail\Core\UI\Interfaces\ClientArea;
use ModulesGarden\Servers\ZimbraEmail\Core\UI\Widget\Forms\FormConstants;

/**
 *
 * Created by PhpStorm.
 * User: Tomasz Bielecki ( tomasz.bi@modulesgarden.com )
 * Date: 18.09.19
 * Time: 13:32
 * Class AddListForm
 */
class AddListForm extends SortedFieldForm implements ClientArea
{
    protected $id    = 'addListForm';
    protected $name  = 'addListForm';

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

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

    }

    public function reloadFormStructure()
    {
        $this->loadDataToForm();
    }
}