<?php

namespace AppBundle\Entity\Booking;

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

/**
 * Données de récurrence d'un évènement, classe de base des récurrences d'évènements
 * @see EventRecur, CourseRecur, EducationalProjectRecur, ExamenRecur, OrganizationHolidayRecur, PersonHolidayRecur
 */
#[ORM\Entity]
#[ORM\InheritanceType('SINGLE_TABLE')]
#[ORM\Table(name: 'BookingRecur')]
#[ORM\DiscriminatorColumn(name: 'discr', type: 'string')]
#[ORM\DiscriminatorMap(['event' => 'EventRecur', 'course' => 'CourseRecur', 'educationalproject' => 'EducationalProjectRecur', 'examen' => 'ExamenRecur', 'organizationholiday' => 'OrganizationHolidayRecur', 'personholiday' => 'PersonHolidayRecur'])]
abstract class AbstractBookingRecur implements IBookingRecur
{
    use TimestampableEntity;
    use CreatorUpdaterEntity;
    /**
     * @var int
     */
    #[ORM\Column(type: 'integer')]
    #[ORM\Id]
    #[ORM\GeneratedValue(strategy: 'AUTO')]
    #[Groups(['bookingrecur', 'planning_list', 'access_details_practicalcourses', 'edu_stu_courses_courses', 'student_registration_courses', 'planning_detail', 'booking_event', 'course_informations_edit', 'examen_informations_edit', 'educationalproject_informations_edit', 'student_list_courses', 'accessholidays_list'])]
    private $id;
    /**
     * @var \DateTime
     */
    #[ORM\Column(type: 'datetime', nullable: true)]
    #[Assert\DateTime]
    #[Groups(['bookingrecur', 'planning_list', 'access_details_practicalcourses', 'edu_stu_courses_courses', 'student_registration_courses', 'planning_detail_eventrecur', 'booking_event_eventrecur', 'accesses_courseteacher_show_practicalcourses', 'course_informations_edit_eventrecur', 'examen_informations_edit_eventrecur', 'educationalproject_informations_edit_eventrecur', 'student_list_courses'])]
    private $datetimeStart;
    /**
     * @var \DateTime
     */
    #[ORM\Column(type: 'datetime', nullable: true)]
    #[Assert\DateTime]
    #[Groups(['bookingrecur', 'planning_list', 'access_details_practicalcourses', 'edu_stu_courses_courses', 'student_registration_courses', 'planning_detail_eventrecur', 'booking_event_eventrecur', 'accesses_courseteacher_show_practicalcourses', 'course_informations_edit_eventrecur', 'examen_informations_edit_eventrecur', 'educationalproject_informations_edit_eventrecur', 'student_list_courses'])]
    private $datetimeEnd;
    /**
     * @var string
     */
    #[ORM\Column(type: 'text')]
    #[Assert\Type(type: 'string')]
    #[Assert\NotNull]
    #[Groups(['bookingrecur', 'planning_list', 'access_details_practicalcourses', 'edu_stu_courses_courses', 'student_registration_courses', 'planning_detail_eventrecur', 'booking_event_eventrecur', 'accesses_courseteacher_show_practicalcourses', 'course_informations_edit_eventrecur', 'examen_informations_edit_eventrecur', 'educationalproject_informations_edit_eventrecur', 'accessholidays_list_eventrecur'])]
    private $rule;
    /**
     * @var IBooking
     * !!!! Please define the ORM\ManyToOne to the child class !!!
     * ORM\ManyToOne(targetEntity="Xxx", inversedBy="eventRecur")
     */
    #[Groups(['bookingrecur'])]
    protected $event;
    /**
     *
     * @var bool
     */
    #[Assert\Type(type: 'boolean')]
    #[Assert\NotNull]
    #[ORM\Column(type: 'boolean', options: ['default' => true])]
    #[Groups(['bookingrecur', 'booking_event_eventrecur', 'student_registration_courses', 'edu_stu_courses_courses', 'student_registration_courses', 'course_informations_edit_eventrecur', 'examen_informations_edit_eventrecur', 'educationalproject_informations_edit_eventrecur'])]
    private $withoutHollidayAndBank = true;
    /**
     * 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 datetimeStart.
     * 
     * @param \DateTime $datetimeStart
     * 
     * @return $this
     */
    public function setDatetimeStart(\DateTime $datetimeStart = null)
    {
        $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 = null)
    {
        $this->datetimeEnd = $datetimeEnd;

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

        return $this;
    }
    /**
     * Gets rule.
     *
     * @return string
     */
    public function getRule()
    {
        return $this->rule;
    }
    /**
     * Sets event.
     *
     * @param IBooking $event
     *
     * @return $this
     */
    public function setEvent(IBooking $event = null)
    {
        $this->event = $event;

        return $this;
    }
    /**
     * Gets event.
     *
     * @return IBooking
     */
    public function getEvent()
    {
        return $this->event;
    }
    /**
     *
     * @return bool
     */
    public function getWithoutHollidayAndBank() {
        return $this->withoutHollidayAndBank;
    }
    /**
     *
     * @param bool $withoutHollidayAndBank
     * @return $this
     */
    public function setWithoutHollidayAndBank($withoutHollidayAndBank) {
        $this->withoutHollidayAndBank = $withoutHollidayAndBank;
        return $this;
    }
    /**
     * NEED THIS FOR ELASTICA RECURR
     * @return null
     */
    public function getDates(){
        return null;
    }
}
