<?php

namespace ThurData\Servers\KerioEmail\App\UI\Client\Setting\Sections;

use ThurData\Servers\KerioEmail\App\Traits\FormExtendedTrait;
use ThurData\Servers\KerioEmail\App\UI\Admin\Custom\Sections\FreeFieldsSection;
use ThurData\Servers\KerioEmail\Core\UI\Widget\Forms\Fields\Switcher;
use ThurData\Servers\KerioEmail\Core\UI\Widget\Forms\Fields\Text;
use ThurData\Servers\KerioEmail\Core\UI\Widget\Forms\Fields\Info;

/**
 *
 * Created by PhpStorm.
 * User: ThurData
 * Date: 12.11.19
 * Time: 13:42
 * Class AdditionalSection
 */
class AdditionalSection extends FreeFieldsSection
{
    protected $id   = 'additionalSection';
    protected $name = 'additionalSection';

    use FormExtendedTrait;

    public function initContent()
    {
        $domain = $this->getWhmcsParamByKey('domain');
        $maildomain = $this->getRequestValue('actionElementId');
        if($domain != $maildomain) {
            $infoalias = new Info('infoaliasdomain');
            $infoalias->setId('infoaliasdomain');
            $infoalias->setName('infoaliasdomain');
            $infoalias->setTitle($maildomain);
            $infoalias->setDescription('infoaliasmessage');
            $this->addField($infoalias);
        }
        $dkimsigenabled = new Switcher('dkimsigenabled');
        $dkimsigenabled->addHtmlAttribute('disabled', true);
        $this->generateDoubleSection([$dkimsigenabled]);
        $tfaenabled = new Switcher('tfaenabled');
        $tfaenabled->addHtmlAttribute('disabled', true);
        $this->generateDoubleSection([$tfaenabled]);
        $chatenabled = new Switcher('chatenabled');
        $chatenabled->addHtmlAttribute('disabled', true);
        $this->generateDoubleSection([$chatenabled]);

    }
}