<?php

namespace ModulesGarden\Servers\OpenXchange\App\UI\Client\EmailAccount\Forms;


use ModulesGarden\Servers\OpenXchange\App\Traits\FormExtendedTrait;
use ModulesGarden\Servers\OpenXchange\Core\UI\Interfaces\ClientArea;
use ModulesGarden\Servers\OpenXchange\Core\UI\Widget\Forms\FormConstants;
use ModulesGarden\Servers\OpenXchange\App\UI\Client\Others\Forms\SortedFieldForm;
use ModulesGarden\Servers\OpenXchange\App\UI\Client\EmailAccount\Sections\EditGeneralSection;
use ModulesGarden\Servers\OpenXchange\App\UI\Client\EmailAccount\Providers\EditAccountDataProvider;
use ModulesGarden\Servers\OpenXchange\Core\UI\Widget\Forms\Fields\Hidden;

/**
 *
 * Created by PhpStorm.
 * User: Tomasz Bielecki ( tomasz.bi@modulesgarden.com )
 * Date: 18.09.19
 * Time: 09:29
 * Class EditAccountForm
 */
class EditAccountForm extends SortedFieldForm implements ClientArea
{
    use FormExtendedTrait;

    protected $id    = 'editAccountForm';
    protected $name  = 'editAccountForm';
    protected $title = 'editAccountForm';

    public function initContent()
    {
        $this->setFormType(FormConstants::UPDATE);
        $this->setProvider(new EditAccountDataProvider());

        $field = new Hidden();
        $field->setId('id');
        $field->setName('id');

        $this->addField($field);
        $this->initFields();
        $this->loadDataToForm();
    }

    public function initFields()
    {
        $this->addSection(new EditGeneralSection());
    }
}