<?php

namespace Lc\ShopBundle\Model;

use App\Entity\Ticket;
use Doctrine\ORM\Mapping as ORM;
use Lc\ShopBundle\Context\TicketInterface;
use Gedmo\Mapping\Annotation as Gedmo;

/**
 * @ORM\MappedSuperclass()
 */
abstract class TicketMessage extends AbstractEntity
{
        use StatusTrait;

        /**
         * @Gedmo\Blameable(on="create")
         * @ORM\ManyToOne(targetEntity="Lc\ShopBundle\Context\UserInterface")
         * @ORM\JoinColumn(nullable=true)
         */
        protected $createdBy;

        /**
         * @Gedmo\Blameable(on="update")
         * @ORM\ManyToOne(targetEntity="Lc\ShopBundle\Context\UserInterface")
         * @ORM\JoinColumn(nullable=true)
         */
        protected $updatedBy;

        /**
         * @ORM\Column(type="text")
         */
        protected $message;

        /**
         * @ORM\ManyToOne(targetEntity="Lc\ShopBundle\Context\TicketInterface", inversedBy="ticketMessages")
         * @ORM\JoinColumn(nullable=false)
         */
        protected $ticket;

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

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

        public function getMessage(): ?string
        {
                return $this->message;
        }

        public function setMessage(string $message): self
        {
                $this->message = $message;

                return $this;
        }

        public function getTicket(): ?TicketInterface
        {
                return $this->ticket;
        }

        public function setTicket(?TicketInterface $ticket): self
        {
                $this->ticket = $ticket;

                return $this;
        }

        public function getAnswerByAdmin(): ?bool
        {
                return $this->answerByAdmin;
        }

        public function setAnswerByAdmin(?bool $answerByAdmin): self
        {
                $this->answerByAdmin = $answerByAdmin;

                return $this;
        }
}
