<?php

namespace AppBundle\Entity\Education;

use AppBundle\Entity\Organization\Organization;
use AppBundle\Annotation\DefaultField;
use AppBundle\Enum\Cycle\CycleEnum;
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;
use AppBundle\Entity\Traits\TimestampableEntity;
use AppBundle\Entity\Traits\CreatorUpdaterEntity;

/**
 * Enum des cycles édcatifs, utilisés par les EducationCurriculum
 * NB: le nombre de cycles est fixé à 6, mais chaque Organization peut en modifier le label
 *
 * @Iri("http://schema.org/Cycle")
 */
#[ORM\Entity]
class Cycle
{
    use TimestampableEntity;
    use CreatorUpdaterEntity;
    /**
     * @var int
     */
    #[ORM\Column(type: 'integer')]
    #[ORM\Id]
    #[ORM\GeneratedValue(strategy: 'AUTO')]
    #[Groups(['cycle', 'cycle_reference', 'educationcurriculum_reference', 'planning_list', 'access_details_practicalcourses', 'student_list_courses', 'educationstudent_reference_educationcurriculum', 'cycle_read', 'cycle_edit'])]
    private $id;
    /**
     * @var Organization
     *
     * @DefaultField
     */
    #[ORM\ManyToOne(targetEntity: 'AppBundle\Entity\Organization\Organization', inversedBy: 'cycles')]
    #[ORM\JoinColumn(nullable: false)]
    #[Assert\NotNull]
    #[Groups(['cycle'])]
    private $organization;
    /**
     * @var integer
     */
    #[ORM\Column(name: '`order`', type: 'integer', nullable: true)]
    #[Assert\Type(type: 'integer', message: 'invalid-integer')]
    #[Groups(['cycle'])]
    private $order;
    /**
     * @var string
     */
    #[ORM\Column(type: 'string')]
    #[Assert\Type(type: 'string')]
    #[Groups(['cycle', 'educationcurriculum_reference_cycle', 'student_list_educationstudent', 'intangible_list_educationcurriculums', 'my_student_list_educationcurriculum', 'planning_list', 'attendancebooking_list_course', 'generate_attendance', 'report_card_educationstudent', 'access_details_practicalcourses', 'presence_attendance_educationcurriculum', 'student_list_courses', 'examen_details_educationcurriculum', 'course_details_educationcurriculum', 'educationstudent_reference_educationcurriculum', 'cycle_reference', 'access_details_educationstudent', 'edu_stu_courses_courses', 'student_registration_courses', 'educationnotation_list_educationstudent', 'examenconvocation_list_examen', 'accesses_courseteacher_show_practicalcourses', 'education_student_next_year_educationcurriculum', 'education_student_next_year_educationstudentlastyear', 'education_input_list_educationcurriculum', 'access_intangible_list_intangible', 'worksbyusers_db_work', 'educationstudent_notation_educationcurriculum', 'accesses_no_reregistred_list_educationstudent', 'cycle_read', 'cycle_edit'])]
    private $label;
    /**
     * @var string
     */
    #[ORM\Column(type: 'string')]
    #[Assert\Type(type: 'string')]
    #[Assert\NotNull]
    #[Assert\Choice(callback: ['\AppBundle\Enum\Cycle\CycleEnum', 'toArray'])]
    #[Groups(['cycle', 'cycle_read'])]
    private $cycleEnum;
    /**
     * @var bool
     */
    #[Assert\Type(type: 'boolean')]
    #[ORM\Column(type: 'boolean', nullable: true, options: ['default' => false])]
    #[Groups(['cycle', 'cycle_read'])]
    private $isSystem;
    /**
     * @var ArrayCollection<CycleByEducation>
     */
    #[ORM\OneToMany(targetEntity: 'AppBundle\Entity\Education\CycleByEducation', mappedBy: 'cycle', orphanRemoval: true)]
    #[Groups(['cycle_cyclebyeducation'])]
    private $cycleByEducations;
    /**
     * Constructor
     */
    public function __construct()
    {
        $this->cycleByEducations = 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 order.
     *
     * @param integer $order
     *
     * @return $this
     */
    public function setOrder($order)
    {
        $this->order = $order;

        return $this;
    }
    /**
     * Gets order.
     *
     * @return integer
     */
    public function getOrder()
    {
        return $this->order;
    }
    /**
     * Sets label.
     * 
     * @param string $label
     * 
     * @return $this
     */
    public function setLabel($label)
    {
        $this->label = $label;

        return $this;
    }
    /**
     * Gets label.
     * 
     * @return string
     */
    public function getLabel()
    {
        return $this->label;
    }
    /**
     * Sets cycleEnum.
     * 
     * @param string $cycleEnum
     * 
     * @return $this
     */
    public function setCycleEnum($cycleEnum)
    {
        $this->cycleEnum = $cycleEnum;

        return $this;
    }
    /**
     * Gets cycleEnum.
     * 
     * @return string
     */
    public function getCycleEnum()
    {
        return $this->cycleEnum;
    }
    /**
     * Sets isSystem.
     *
     * @param bool $isSystem
     *
     * @return $this
     */
    public function setIsSystem($isSystem)
    {
        $this->isSystem = $isSystem;

        return $this;
    }
    /**
     * Gets isSystem.
     *
     * @return bool
     */
    public function getIsSystem()
    {
        return $this->isSystem;
    }
    /**
     * Add cycleByEducation
     *
     * @param \AppBundle\Entity\Education\CycleByEducation $cycleByEducation
     *
     * @return Cycle
     */
    public function addCycleByEducation(\AppBundle\Entity\Education\CycleByEducation $cycleByEducation)
    {
        $this->cycleByEducations[] = $cycleByEducation;

        return $this;
    }
    /**
     * Remove cycleByEducation
     *
     * @param \AppBundle\Entity\Education\CycleByEducation $cycleByEducation
     */
    public function removeCycleByEducation(\AppBundle\Entity\Education\CycleByEducation $cycleByEducation)
    {
        $this->cycleByEducations->removeElement($cycleByEducation);
    }
    /**
     * Get cycleByEducations
     *
     * @return \Doctrine\Common\Collections\Collection
     */
    public function getCycleByEducations()
    {
        return $this->cycleByEducations;
    }
}
