<?php


namespace App\Model\Entities\Components\Navigation;

use App\Model\Entities\Components\News\NewsContainer;
use App\Model\Interfaces\IResource;
use Doctrine\ORM\Mapping as ORM;

/**
 * @ORM\Entity
 */
class NavItemNews extends BaseNavItem
{
    /**
     * @var NewsContainer
     * @ORM\OneToOne(targetEntity="App\Model\Entities\Components\News\NewsContainer")
     */
    protected $news;

    /**
     * @return NewsContainer
     */
    public function getNews() : NewsContainer
    {
        return $this->news;
    }

    /**
     * @param NewsContainer $news
     */
    public function setNews(NewsContainer $news)
    {
        $this->news = $news;
    }

    public function getLinkDestination() : string
    {
       return 'News:list';
    }

    public function getLinkParams() : array
    {
       return ['id' => $this->news->getId()];
    }

    public function getResource() : IResource
    {
        return $this->news;
    }
}