<?php
namespace ModulesGarden\Servers\OpenXchange\App\UI\Client\EmailCatchAll\Forms;
use ModulesGarden\Servers\OpenXchange\Core\UI\Interfaces\ClientArea;
use ModulesGarden\Servers\OpenXchange\Core\UI\Widget\Forms\Fields\Text;
use ModulesGarden\Servers\OpenXchange\Core\UI\Widget\Forms\Fields\Hidden;
use ModulesGarden\Servers\OpenXchange\Core\UI\Widget\Forms\Fields\Select;
use ModulesGarden\Servers\OpenXchange\Core\UI\Widget\Forms\FormConstants;
use ModulesGarden\Servers\OpenXchange\Core\UI\Widget\Forms\Sections\InputGroup;
use ModulesGarden\Servers\OpenXchange\App\UI\Client\Others\Forms\SortedFieldForm;
use ModulesGarden\Servers\OpenXchange\Core\UI\Widget\Forms\Fields\InputGroupElements;
use ModulesGarden\Servers\OpenXchange\App\UI\Client\EmailAccount\Providers\AccountDataProvider;
use ModulesGarden\Servers\OpenXchange\App\UI\Client\EmailCatchAll\Providers\AddEmailCatchAllDataProvider;

/**
 *
 * Created by PhpStorm.
 * User: Tomasz Bielecki ( tomasz.bi@modulesgarden.com )
 * Date: 18.09.19
 * Time: 11:50
 * Class AddEmailCatchAllForm
 */
class AddEmailCatchAllForm extends SortedFieldForm implements ClientArea
{
    protected $id    = 'addEmailCatchAllForm';
    protected $name  = 'addEmailCatchAllForm';
    protected $title = 'addEmailCatchAllForm';

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

    public function initFields()
    {
        $field = new Text('domain');
        $field->addHtmlAttribute('readonly', 'true');
        $this->addField($field);

        $field = new Select('catchall');
        $field->notEmpty();
        $this->addField($field);
    }
}