<?php

namespace Lc\SovBundle\Model\Site;

use Doctrine\ORM\Mapping as ORM;
use Gedmo\Mapping\Annotation as Gedmo;
use Lc\SovBundle\Doctrine\Extension\OpenGraphInterface;
use Lc\SovBundle\Doctrine\Extension\OpenGraphTrait;
use Lc\SovBundle\Doctrine\Pattern\AbstractFullEntity;
use Lc\SovBundle\Model\File\FileInterface;
use Lc\SovBundle\Model\Newsletter\NewsletterInterface;

/**
 * @ORM\MappedSuperclass()
 */
abstract class NewsModel extends AbstractFullEntity implements NewsInterface
{
    /**
     * @ORM\Column(type="datetime")
     * @Gedmo\Timestampable(on="create")
     */
    protected $date;

    /**
     * @ORM\Column(type="boolean", nullable=true)
     */
    protected $isSent;

    /**
     * @ORM\ManyToOne(targetEntity="Lc\SovBundle\Model\Newsletter\NewsletterInterface")
     */
    protected $newsletter;

    /**
     * @ORM\ManyToOne(targetEntity="Lc\SovBundle\Model\File\FileInterface", cascade={"persist", "remove"})
     */
    protected $image;

    public function __toString()
    {
        return $this->getTitle();
    }

    public function getDate(): ?\DateTimeInterface
    {
        return $this->date;
    }

    public function setDate(\DateTimeInterface $date): self
    {
        $this->date = $date;

        return $this;
    }

    public function getIsSent(): ?bool
    {
        return $this->isSent;
    }

    public function setIsSent(?bool $isSent): self
    {
        $this->isSent = $isSent;

        return $this;
    }

    public function getImage(): ?FileInterface
    {
        return $this->image;
    }

    public function setImage(?FileInterface $image): self
    {
        $this->image = $image;

        return $this;
    }

    public function getNewsletter(): ?NewsletterInterface
    {
        return $this->newsletter;
    }

    public function setNewsletter(?NewsletterInterface $newsletter): self
    {
        $this->newsletter = $newsletter;

        return $this;
    }
}
