<?php

namespace AppBundle\Entity\Education;

use AppBundle\Entity\Organization\Organization;
use AppBundle\Annotation\DefaultField;
use Doctrine\Common\Collections\ArrayCollection;
use Doctrine\ORM\Mapping as ORM;
use Dunglas\ApiBundle\Annotation\Iri;
use Symfony\Component\Serializer\Annotation\Groups;
use Symfony\Component\Validator\Constraints as Assert;

/**
 * Temps d'un enseignement
 *
 * @Iri("http://schema.org/Cycle")
 */
#[ORM\Entity]
class EducationTiming
{
    /**
     * @var int
     */
    #[ORM\Column(type: 'integer')]
    #[ORM\Id]
    #[ORM\GeneratedValue(strategy: 'AUTO')]
    #[Groups(['educationtiming', 'educationcurriculum_reference', 'educationtiming_reference', 'access_details_educationstudent', 'student_list_educationstudent', 'education_student_next_year', 'education_student_next_year_educationstudentlastyear'])]
    private $id;
    /**
     * @var Organization
     *
     * @DefaultField
     */
    #[ORM\ManyToOne(targetEntity: 'AppBundle\Entity\Organization\Organization', inversedBy: 'educationTimings')]
    #[ORM\JoinColumn(nullable: false)]
    #[Assert\NotNull]
    #[Groups(['educationtiming'])]
    private $organization;
    /**
     * @var string
     */
    #[ORM\Column(type: 'integer')]
    #[Assert\Type(type: 'integer', message: 'Cette valeur doit être un nombre.')]
    #[Assert\GreaterThan(0)]
    #[Groups(['educationtiming', 'educationcurriculum_reference_educationtimings', 'educationtiming_reference', 'access_details_educationstudent', 'student_list_educationstudent', 'education_student_next_year_educationtiming', 'education_student_next_year_educationstudentlastyear'])]
    private $timing;
    /**
     * @var ArrayCollection<CycleByEducation>
     */
    #[ORM\OneToMany(targetEntity: 'AppBundle\Entity\Education\EducationStudent', mappedBy: 'educationTiming', orphanRemoval: true)]
    private $educationStudents;
    /**
     * @var Education
     */
    #[ORM\ManyToMany(targetEntity: 'AppBundle\Entity\Education\EducationCurriculum', mappedBy: 'educationTimings')]
    #[Groups(['educationtiming_reference'])]
    private $educationCurriculums;
    /**
     * Constructor
     */
    public function __construct()
    {
        $this->educationStudent = new ArrayCollection();
        $this->educationCurriculums = new ArrayCollection();
    }
    /**
     * 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 organization.
     *
     * @param Organization $organization
     *
     * @return $this
     */
    public function setOrganization(Organization $organization)
    {
        $this->organization = $organization;

        return $this;
    }
    /**
     * Gets organization.
     *
     * @return Organization
     */
    public function getOrganization()
    {
        return $this->organization;
    }
    /**
     * Sets $timing.
     *
     * @param integer $timing
     *
     * @return $this
     */
    public function setTiming($timing)
    {
        $this->timing = $timing;

        return $this;
    }
    /**
     * Gets label.
     *
     * @return integer
     */
    public function getTiming()
    {
        return $this->timing;
    }
    /**
     * Add $educationStudent
     *
     * @param \AppBundle\Entity\Education\EducationStudent $educationStudent
     *
     * @return EducationTiming
     */
    public function addCycleByEducation(\AppBundle\Entity\Education\EducationStudent $educationStudent)
    {
        $this->educationStudents[] = $educationStudent;

        return $this;
    }
    /**
     * Remove $educationStudent
     *
     * @param \AppBundle\Entity\Education\EducationStudent $educationStudent
     */
    public function removeCycleByEducation(\AppBundle\Entity\Education\EducationStudent $educationStudent)
    {
        $this->educationStudents->removeElement($educationStudent);
    }
    /**
     * Get cycleByEducations
     *
     * @return \Doctrine\Common\Collections\Collection
     */
    public function getCycleByEducations()
    {
        return $this->educationStudents;
    }
    /**
     * Add $educationCurriculum
     *
     * @param \AppBundle\Entity\Education\EducationCurriculum $educationCurriculum
     *
     * @return EducationTiming
     */
    public function addEducationCurriculum(\AppBundle\Entity\Education\EducationCurriculum $educationCurriculum)
    {
        $this->educationCurriculums[] = $educationCurriculum;

        return $this;
    }
    /**
     * Remove $educationCurriculum
     *
     * @param \AppBundle\Entity\Education\EducationCurriculum $educationCurriculum
     */
    public function removeEducationCurriculum(\AppBundle\Entity\Education\EducationCurriculum $educationCurriculum)
    {
        $this->educationCurriculums->removeElement($educationCurriculum);
    }
    /**
     * Get EducationCurriculum
     *
     * @return \Doctrine\Common\Collections\Collection
     */
    public function getEducationCurriculums()
    {
        return $this->educationCurriculums;
    }
}
