<?php
namespace ModulesGarden\Servers\ZimbraEmail\App\UI\Admin\Custom\Pages;
use ModulesGarden\Servers\ZimbraEmail\Core\Helper\BuildUrl;
use ModulesGarden\Servers\ZimbraEmail\Core\UI\Builder\BaseContainer;
use ModulesGarden\Servers\ZimbraEmail\Core\UI\Interfaces\ClientArea;
use ModulesGarden\Servers\ZimbraEmail\Core\UI\Traits\Alerts;

/**
 *
 * Created by PhpStorm.
 * User: Tomasz Bielecki ( tomasz.bi@modulesgarden.com )
 * Date: 03.10.19
 * Time: 15:13
 * Class Description
 */
class Description extends BaseContainer implements ClientArea
{
    use Alerts;
    protected $id    = 'description';
    protected $name  = 'description';
    protected $title = 'description';
    protected $description;

    public function __construct($baseId = null, $hasAlert = false,$type = null)
    {
        parent::__construct($baseId);
        $this->setTitle($baseId . 'PageTitle');
        $this->setDescription($baseId . 'PageDescription');
        if($hasAlert)
        {
            $this->addInternalAlert($baseId . 'AlertDescription',$type);
        }
    }

    public function getDescription()
    {
        return $this->description;
    }

    public function setDescription($description)
    {
        $this->description = $description;
        return $this;
    }

    public function getAssetsUrl()
    {
        return BuildUrl::getAssetsURL();
    }

    public function getIcon()
    {
        $asset = BuildUrl::getAppAssetsURL();
        return $asset.DIRECTORY_SEPARATOR.'icons'.DIRECTORY_SEPARATOR.$this->id.'.png';
    }
}