<?php

namespace AppBundle\Entity\Booking;

use AppBundle\Entity\AccessAndFunction\Access;
use Doctrine\ORM\Mapping as ORM;
use Dunglas\ApiBundle\Annotation\Iri;
use Symfony\Component\Serializer\Annotation\Groups;
use AppBundle\Entity\Traits\TimestampableEntity;
use AppBundle\Entity\Traits\CreatorUpdaterEntity;
use Symfony\Component\Validator\Constraints as Assert;

/**
 *
 * Participation d'un Access à un Event
 *
 * @Iri("http://schema.org/EventUser")
 */
#[ORM\Entity]
#[ORM\Table]
#[ORM\Index(name: 'participation', columns: ['participation'])]
#[ORM\Index(name: 'datetimeStart', columns: ['datetimeStart'])]
class EventUser
{
    use TimestampableEntity;
    use CreatorUpdaterEntity;
    /**
     * @var int
     */
    #[ORM\Column(type: 'integer')]
    #[ORM\Id]
    #[ORM\GeneratedValue(strategy: 'AUTO')]
    #[Groups(['eventuser', 'presence_attendance', 'event_details'])]
    private $id;
    /**
     * @var Event
     */
    #[ORM\ManyToOne(targetEntity: 'Event', inversedBy: 'eventUser')]
    #[Groups(['eventuser', 'invitations_list'])]
    private $event;
    /**
     * @var Access
     */
    #[ORM\ManyToOne(targetEntity: 'AppBundle\Entity\AccessAndFunction\Access', inversedBy: 'eventUsers')]
    #[Groups(['eventuser', 'presence_attendance_eventuser', 'event_details_eventuserfiltered', 'invitations_list', 'event_details_eventuser'])]
    private $guest;
    /**
     * @var string
     */
    #[ORM\Column(type: 'string', nullable: true)]
    #[Assert\Type(type: 'string')]
    #[Assert\Choice(callback: ['\AppBundle\Enum\Booking\ParticipationStatusEnum', 'toArray'])]
    #[Groups(['eventuser', 'invitations_list', 'event_details_eventuser'])]
    private $participation;
    /**
     * @var string
     */
    #[ORM\Column(type: 'string', options: ['default' => 'READY'])]
    #[Assert\Type(type: 'string')]
    #[Assert\NotNull]
    #[Assert\Choice(callback: ['\AppBundle\Enum\Message\MessageStatusEnum', 'toArray'])]
    #[Groups(['eventuser'])]
    private $statusMail = "READY";
    /**
     * @var \DateTime
     */
    #[ORM\Column(type: 'datetime')]
    #[Assert\DateTime]
    #[Assert\NotNull]
    #[Groups(['eventuser', 'invitations_list', 'presence_attendance_eventuser', 'event_details_eventuser'])]
    private $datetimeStart;
    /**
     * @var \DateTime
     */
    #[ORM\Column(type: 'datetime', nullable: true)]
    #[Assert\DateTime]
    #[Groups(['eventuser', 'invitations_list'])]
    private $datetimeEnd;
    /**
     * @var bool
     */
    #[ORM\Column(type: 'boolean', options: ['default' => false])]
    #[Assert\Type(type: 'boolean')]
    #[Assert\NotNull]
    #[Groups(['eventuser'])]
    private $attendance = false;
    /**
     * Sets id.
     *
     * @param int $id
     *
     * @return $this
     */
    public function setId($id)
    {
        $this->id = $id;

        return $this;
    }
    /**
     * Gets id.
     *
     * @return int
     */
    public function getId()
    {
        return $this->id;
    }
    /**
     * Sets event.
     *
     * @param Event $event
     *
     * @return $this
     */
    public function setEvent(Event $event = null)
    {
        $this->event = $event;

        return $this;
    }
    /**
     * Gets event.
     *
     * @return Event
     */
    public function getEvent()
    {
        return $this->event;
    }
    /**
     * Sets guest.
     *
     * @param Access $guest
     *
     * @return $this
     */
    public function setGuest(Access $guest = null)
    {
        $this->guest = $guest;

        return $this;
    }
    /**
     * Gets guest.
     *
     * @return Access
     */
    public function getGuest()
{
    return $this->guest;
}
    /**
     * Sets participation.
     *
     * @param string $participation
     *
     * @return $this
     */
    public function setParticipation($participation)
    {
        $this->participation = $participation;

        return $this;
    }
    /**
     * Gets participation.
     *
     * @return string
     */
    public function getParticipation()
    {
        return $this->participation;
    }
    /**
     * Sets datetimeStart.
     *
     * @param \DateTime $datetimeStart
     *
     * @return $this
     */
    public function setDatetimeStart(\DateTime $datetimeStart)
    {
        $this->datetimeStart = $datetimeStart;

        return $this;
    }
    /**
     * Gets datetimeStart.
     *
     * @return \DateTime
     */
    public function getDatetimeStart()
    {
        return $this->datetimeStart;
    }
    /**
     * Sets datetimeEnd.
     *
     * @param \DateTime $datetimeEnd
     *
     * @return $this
     */
    public function setDatetimeEnd(\DateTime $datetimeEnd)
    {
        $this->datetimeEnd = $datetimeEnd;

        return $this;
    }
    /**
     * Gets datetimeEnd.
     *
     * @return \DateTime
     */
    public function getDatetimeEnd()
    {
        return $this->datetimeEnd;
    }
    /**
     * Sets attendance.
     * 
     * @param bool $attendance
     * 
     * @return $this
     */
    public function setAttendance($attendance)
    {
        $this->attendance = $attendance;

        return $this;
    }
    /**
     * Gets attendance.
     * 
     * @return bool
     */
    public function getAttendance()
    {
        return $this->attendance;
    }
    /**
     * Sets statusMail.
     *
     * @param string $statusMail
     *
     * @return $this
     */
    public function setStatusMail($statusMail)
    {
        $this->statusMail = $statusMail;

        return $this;
    }
    /**
     * Gets statusMail.
     *
     * @return string
     */
    public function getStatusMail()
    {
        return $this->statusMail;
    }
}
