<?php
namespace ThurData\Servers\KerioEmail\App\UI\Client\DistributionList\Forms;
use ThurData\Servers\KerioEmail\App\UI\Admin\Custom\Forms\SortedFieldForm;
use ThurData\Servers\KerioEmail\App\UI\Client\DistributionList\Providers\AddListDataProvider;
use ThurData\Servers\KerioEmail\App\UI\Client\DistributionList\Sections\AddMembersDistribution;
use ThurData\Servers\KerioEmail\App\UI\Client\DistributionList\Sections\AddPreferencesDistribution;
use ThurData\Servers\KerioEmail\App\UI\Client\DistributionList\Sections\AddPropertiesDistribution;
use ThurData\Servers\KerioEmail\Core\UI\Interfaces\ClientArea;
use ThurData\Servers\KerioEmail\Core\UI\Widget\Forms\FormConstants;

/**
 *
 * Created by PhpStorm.
 * User: ThurData
 * 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 AddPreferencesDistribution());

    }

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