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

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\EditListDataProvider;
use ThurData\Servers\KerioEmail\App\UI\Client\DistributionList\Sections\AddPreferencesDistribution;
use ThurData\Servers\KerioEmail\App\UI\Client\DistributionList\Sections\EditMembersDistribution;
use ThurData\Servers\KerioEmail\App\UI\Client\DistributionList\Sections\EditPropertiesDistribution;
use ThurData\Servers\KerioEmail\Core\UI\Interfaces\ClientArea;
use ThurData\Servers\KerioEmail\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 AddPreferencesDistribution());

    }

    public function reloadFormStructure()
    {

        $this->loadDataToForm();
    }

}