<?php

namespace AppBundle\Entity\Core;
use AppBundle\Entity\AccessAndFunction\Access;
use AppBundle\Entity\Traits\TimestampableEntity;
use AppBundle\Entity\Traits\CreatorUpdaterEntity;
use AppBundle\Annotation\DefaultField;
use Doctrine\ORM\Mapping as ORM;
use Symfony\Component\Serializer\Annotation\Groups;
use Symfony\Component\Validator\Constraints as Assert;

/**
 * Fais le lien entre une Notification et un Access
 */
#[ORM\Entity]
class NotificationUser
{
    use TimestampableEntity;
    use CreatorUpdaterEntity;
    /**
     * @var int
     */
    #[ORM\Column(type: 'integer')]
    #[ORM\Id]
    #[ORM\GeneratedValue(strategy: 'AUTO')]
    #[Groups(['notificationuser'])]
    private $id;
    /**
     * @var Notification
     */
    #[ORM\ManyToOne(targetEntity: 'AppBundle\Entity\Core\AbstractInformation', inversedBy: 'notificationUsers')]
    #[ORM\JoinColumn(nullable: false)]
    #[Groups(['notificationuser'])]
    private $notification;
    /**
     * @var Access
     *
     * @DefaultField
     */
    #[ORM\ManyToOne(targetEntity: 'AppBundle\Entity\AccessAndFunction\Access', inversedBy: 'notificationUsers')]
    #[ORM\JoinColumn(nullable: false)]
    #[Groups(['notificationuser'])]
    private $access;
    /**
     * @var boolean
     */
    #[ORM\Column(type: 'boolean', options: ['default' => 0])]
    #[Assert\Type(type: 'boolean')]
    #[Groups(['notificationuser'])]
    private $isRead = 0;
    /**
     * Get id
     *
     * @return integer
     */
    public function getId()
    {
        return $this->id;
    }
    /**
     * Set isRead
     *
     * @param boolean $isRead
     *
     * @return NotificationUser
     */
    public function setIsRead($isRead)
    {
        $this->isRead = $isRead;

        return $this;
    }
    /**
     * Get isRead
     *
     * @return boolean
     */
    public function getIsRead()
    {
        return $this->isRead;
    }
    /**
     * Set notification
     *
     * @param AbstractInformation $notification
     *
     * @return NotificationUser
     */
    public function setNotification(AbstractInformation $notification)
    {
        $this->notification = $notification;

        return $this;
    }
    /**
     * Get notification
     *
     * @return Notification
     */
    public function getNotification()
    {
        return $this->notification;
    }
    /**
     * Set access
     *
     * @param Access $access
     *
     * @return NotificationUser
     */
    public function setAccess(Access $access)
    {
        $this->access = $access;

        return $this;
    }
    /**
     * Get access
     *
     * @return Access
     */
    public function getAccess()
    {
        return $this->access;
    }
}
