<?php


namespace App\Components\Breadcrumb;


use Nette\ComponentModel\Component;

class BreadcrumbNode extends Component
{
    /** @var  BreadcrumbNode */
    protected $prev;
    /** @var  BreadcrumbNode */
    protected $next;

    /** @var  string */
    protected $title;
    /** @var  string */
    protected $link;
    /** @var  string */
    protected $icon;
    /** @var  bool */
    protected $isActive;

    /**
     * @return BreadcrumbNode|null
     */
    public function getPrev()
    {
        return $this->prev;
    }

    /**
     * @param BreadcrumbNode $prev
     * @return BreadcrumbNode
     */
    public function setPrev(BreadcrumbNode $prev)
    {
        $this->prev = $prev;
        $prev->next = $this;
    }

    /**
     * @return BreadcrumbNode|null
     */
    public function getNext()
    {
        return $this->next;
    }

    /**
     * @param BreadcrumbNode $next
     * @return BreadcrumbNode
     */
    public function setNext(BreadcrumbNode $next)
    {
        $this->next = $next;
        $next->prev = $this;
    }

    /**
     * @return mixed
     */
    public function getTitle()
    {
        return $this->title;
    }

    /**
     * @param string $title
     * @return BreadcrumbNode
     */
    public function setTitle(string $title)
    {
        $this->title = $title;
        return $this;
    }

    /**
     * @return string
     */
    public function getLink() : string
    {
        return $this->link;
    }

    /**
     * @param string $link
     * @return BreadcrumbNode
     */
    public function setLink(string $link) : BreadcrumbNode
    {
        $this->link = $link;
        return $this;
    }

    /**
     * @return string | null
     */
    public function getIcon()
    {
        return $this->icon;
    }

    public function setIcon(string $icon) : BreadcrumbNode
    {
        $this->icon = $icon;
        return $this;
    }

    public function setFaIcon(string $icon) : BreadcrumbNode
    {
        return $this->setIcon("fa fa-{$icon}");
    }

    public function setGlypicon(string $icon) : BreadcrumbNode
    {
        return $this->setIcon("glypicon glyphicon-{$icon}");
    }

    public function isActive() : bool
    {
        return $this->isActive;
    }

    public function setIsActive(bool $isLinkCurrent) : BreadcrumbNode
    {
        $this->isActive = $isLinkCurrent;
        return $this;
    }

}