<?php

namespace AppBundle\Entity\Education;

use AppBundle\Annotation\ExportSplitFields;
use AppBundle\Entity\Booking\Course;
use AppBundle\Entity\Core\Tagg;
use AppBundle\Entity\Message\Message;
use AppBundle\Enum\Education\PratiqueEnum;
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;

/**
 * Enseignement proposé par une Organization
 *
 * @Iri("http://schema.org/Education")
 */
#[ORM\Entity]
class Education
{
    use TimestampableEntity;
    use CreatorUpdaterEntity;
    /**
     * @var string
     */
    #[ORM\Column(type: 'string', length: 500, nullable: true)]
    #[Assert\Type(type: 'string')]
    private $legacyId;
    /**
     * @var int
     */
    #[ORM\Column(type: 'integer')]
    #[ORM\Id]
    #[ORM\GeneratedValue(strategy: 'AUTO')]
    #[Groups(['education', 'educationcurriculum_reference', 'examenconvocation_list_examen', 'planning_list', 'generate_attendance', 'access_details_practicalcourses', 'presence_attendance', 'examen_details', 'course_details', 'educationstudent_reference_educationcurriculum', 'education_edit', 'planning_detail', 'education_student_wish_list'])]
    private $id;
    /**
     * @var ArrayCollection<EducationCurriculum>
     */
    #[Assert\Valid]
    #[ORM\OneToMany(targetEntity: 'EducationCurriculum', mappedBy: 'education', cascade: ['persist'], orphanRemoval: true)]
    #[Groups(['educationcurriculum', 'education_educationcurriculum', 'examenconvocation_list_examen', 'access_details_practicalcourses', 'education_edit', 'accesses_no_reregistred_list_educationstudent', 'educations_quotas_stats'])]
    private $educationCurriculums;
    /**
     * @var ArrayCollection<CycleByEducation>
     */
    #[Assert\Valid]
    #[ORM\OneToMany(targetEntity: 'CycleByEducation', mappedBy: 'education', cascade: ['persist'], orphanRemoval: true)]
    #[Groups(['education_cyclebyeducation'])]
    private $cycleByEducations;
    /**
     * @var EducationCategory
     */
    #[ORM\ManyToOne(targetEntity: 'EducationCategory', inversedBy: 'educations', fetch: 'EAGER')]
    #[ORM\JoinColumn(nullable: false)]
    #[Groups(['education', 'access_details_educationstudent', 'educationcurriculum_reference_education', 'education_reference', 'student_list_educationstudent', 'intangible_list_educationcurriculums', 'examenconvocation_list_examen', 'my_student_list_educationcurriculum', 'planning_list', 'attendancebooking_list_course', 'generate_attendance', 'report_card_educationstudent', 'access_details_practicalcourses', 'presence_attendance_education', 'student_list_courses', 'examen_details_education', 'course_details_education', 'educationstudent_reference_educationcurriculum', 'edu_stu_courses_courses', 'student_registration_courses', 'educationnotation_list_educationstudent', 'education_edit', 'accesses_courseteacher_show_practicalcourses', 'planning_detail_education', 'education_input_list_educationcurriculum', 'education_input_list_access', 'education_input_list_access', 'access_attendance_detail_attendancebookings', 'education_student_wish_list_educationwish', 'education_student_next_year_educationcurriculum', 'education_student_next_year_educationstudentlastyear', 'access_intangible_list_intangible', 'worksbyusers_db_work', 'accesses_no_reregistred_list_educationstudent', 'educations_quotas_by_education_list', 'educationstudent_notation_educationcurriculum', 'educations_quotas_stats'])]
    private $educationCategory;
    /**
     * @var EducationComplement
     */
    #[ORM\ManyToOne(targetEntity: 'EducationComplement', fetch: 'EAGER')]
    #[ORM\JoinColumn(nullable: false)]
    #[Groups(['education', 'access_details_educationstudent', 'educationcurriculum_reference_education', 'education_reference', 'student_list_educationstudent', 'student_list_courses', 'intangible_list_educationcurriculums', 'examenconvocation_list_examen', 'my_student_list_educationcurriculum', 'planning_list', 'attendancebooking_list_course', 'generate_attendance', 'report_card_educationstudent', 'access_details_practicalcourses', 'presence_attendance_education', 'examen_details_education', 'course_details_education', 'educationstudent_reference_educationcurriculum', 'edu_stu_courses_courses', 'student_registration_courses', 'educationnotation_list_educationstudent', 'education_edit', 'education_input_list_educationcurriculum', 'education_input_list_access', 'education_input_list_access', 'access_attendance_detail_attendancebookings', 'education_student_wish_list_educationwish', 'access_intangible_list_intangible', 'worksbyusers_db_work', 'educationstudent_notation_educationcurriculum', 'accesses_no_reregistred_list_educationstudent', 'educations_quotas_by_education_list', 'educations_quotas_stats'])]
    private $educationComplement;
    /**
     * @var bool
     */
    #[ORM\Column(type: 'boolean', options: ['default' => true])]
    #[Assert\Type(type: 'boolean')]
    #[Assert\NotNull]
    #[Groups(['education', 'education_edit', 'educations_quotas_by_education_list', 'educations_quotas_stats'])]
    private $hasCycle = true;
    /**
     * @var ArrayCollection<Course>
     */
    #[ORM\OneToMany(targetEntity: 'AppBundle\Entity\Booking\Course', mappedBy: 'education')]
    #[Groups(['education_course'])]
    private $courses;
    /**
     * @var ArrayCollection<Examen>
     */
    #[ORM\OneToMany(targetEntity: 'AppBundle\Entity\Booking\Examen', mappedBy: 'education')]
    #[Groups(['education_examen'])]
    private $examens;
    /**
     * @var ArrayCollection<EducationTeacher>
     */
    #[ORM\OneToMany(targetEntity: 'AppBundle\Entity\Education\EducationTeacher', mappedBy: 'education', orphanRemoval: true)]
    #[Groups(['education_educationteacher'])]
    private $educationTeachers;
    /**
     * @var bool
     */
    #[ORM\Column(type: 'boolean', options: ['default' => true])]
    #[Assert\Type(type: 'boolean')]
    #[Assert\NotNull]
    #[Groups(['education', 'education_edit'])]
    private $isActive = true;
    /**
     * @var string
     * @ExportSplitFields({"educationCategory.label","educationComplementTemplate"})
     */
    #[Groups(['education', 'examenconvocation_list_examen', 'report_card_examenconvocations'])]
    private $fullLabelTemplate;
    /**
     * @var string
     */
    #[Groups(['education', 'template', 'education_student_next_year_educationcurriculum', 'education_student_next_year_educationstudentlastyear'])]
    private $educationComplementTemplate;
    /**
     * @var integer
     */
    #[ORM\Column(type: 'integer', nullable: true)]
    #[Assert\Type(type: 'integer')]
    #[Groups(['education', 'education_edit'])]
    private $availablePlaces;
    /**
     * @var integer
     */
    #[Groups(['educations_quotas_by_education_list', 'educations_quotas_stats'])]
    private $totalAvailablePlaces;
    /**
     * @var integer
     */
    #[Groups(['educations_quotas_by_education_list', 'educations_quotas_stats'])]
    private $totalEducationStudents;
    /**
     * @var integer
     */
    #[Groups(['educations_quotas_by_education_list'])]
    private $totalPendingRegistrations;
    /**
     * @var integer
     */
    #[Groups(['educations_quotas_by_education_list'])]
    private $totalPotentialRegistrations;
    /**
     * @var integer
     */
    #[Groups(['educations_quotas_by_education_list', 'educations_quotas_stats'])]
    private $fillingRate;
    /**
     * @var integer
     */
    #[Groups(['educations_quotas_by_education_list'])]
    private $potentialFillingRate;
    /**
     * @var integer
     */
    #[Groups(['educations_quotas_stats'])]
    private $averageFillingRate;
    /**
     * @var bool
     */
    #[ORM\Column(type: 'boolean', options: ['default' => false])]
    #[Assert\Type(type: 'boolean')]
    #[Assert\NotNull]
    #[Groups(['education', 'education_edit', 'educations_quotas_stats', 'educations_quotas_by_education_list'])]
    private $availablePlacesAccordingToLevel = false;
    /**
     * @var ArrayCollection<Tagg>
     */
    #[ORM\ManyToMany(targetEntity: 'AppBundle\Entity\Core\Tagg', cascade: ['persist'], inversedBy: 'educations')]
    #[Assert\Valid]
    #[ORM\JoinTable(name: 'tag_education', joinColumns: [], inverseJoinColumns: [])]
    #[ORM\JoinColumn(name: 'education_id', referencedColumnName: 'id')]
    #[ORM\JoinColumn(name: 'tag_id', referencedColumnName: 'id')]
    #[Groups(['education_tags', 'manage_tags', 'education_edit'])]
    private $tags;
    /**
     * @var EducationNotationConfig
     */
    #[ORM\ManyToOne(targetEntity: 'AppBundle\Entity\Education\EducationNotationConfig')]
    #[ORM\JoinColumn(referencedColumnName: 'id', nullable: true, onDelete: 'SET NULL')]
    private $educationNotationConfig;
    /**
     * @var string
     */
    #[ORM\Column(type: 'text', nullable: true)]
    #[Assert\Type(type: 'string')]
    #[Groups(['education', 'education_edit'])]
    private $description;
    /**
     * @var string
     */
    #[ORM\Column(type: 'text', nullable: true)]
    #[Assert\Type(type: 'string')]
    #[Groups(['education', 'education_edit'])]
    private $educationalTarget;
    /**
     * @var string
     */
    #[ORM\Column(type: 'text', nullable: true)]
    #[Assert\Type(type: 'string')]
    #[Groups(['education', 'education_edit'])]
    private $educationalContent;
    /**
     * @var string
     */
    #[ORM\Column(type: 'text', nullable: true)]
    #[Assert\Type(type: 'string')]
    #[Groups(['education', 'education_edit'])]
    private $howToEvaluate;
    /**
     * @var string
     */
    #[ORM\Column(type: 'text', nullable: true)]
    #[Assert\Type(type: 'string')]
    #[Groups(['education', 'education_edit'])]
    private $prerequisite;
    public function __construct() {
        $this->educationCurriculums = new ArrayCollection();
        $this->cycleByEducations = new ArrayCollection();
        $this->courses = new ArrayCollection();
        $this->examens = new ArrayCollection();
        $this->educationTeachers = new ArrayCollection();
        $this->tags = new ArrayCollection();
    }
    /**
     * Sets legacyId.
     *
     * @param string $legacyId
     *
     * @return $this
     */
    public function setLegacyId($legacyId)
    {
        $this->legacyId = $legacyId;

        return $this;
    }
    /**
     * Gets legacyId.
     *
     * @return string
     */
    public function getLegacyId()
    {
        return $this->legacyId;
    }
    /**
     * 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 education category.
     *
     * @param EducationCategory $educationCategory
     *
     * @return $this
     */
    public function setEducationCategory(EducationCategory $educationCategory = null)
    {
        $this->educationCategory = $educationCategory;

        return $this;
    }
    /**
     * Gets educationCategory.
     *
     * @return EducationCategory
     */
    public function getEducationCategory()
    {
        return $this->educationCategory;
    }
    /**
     * Sets education complement.
     *
     * @param EducationComplement $educationComplement
     *
     * @return $this
     */
    public function setEducationComplement(EducationComplement $educationComplement = null)
    {
        $this->educationComplement = $educationComplement;

        return $this;
    }
    /**
     * Gets educationComplement.
     *
     * @return EducationComplement
     */
    public function getEducationComplement()
    {
        return $this->educationComplement;
    }
    /**
     * Set hasCycle
     *
     * @param boolean $hasCycle
     *
     * @return Education
     */
    public function setHasCycle($hasCycle)
    {
        $this->hasCycle = $hasCycle;

        return $this;
    }
    /**
     * Get hasCycle
     *
     * @return boolean
     */
    public function getHasCycle()
    {
        return $this->hasCycle;
    }
    /**
     * Gets educationCurriculums.
     *
     * @return ArrayCollection<EducationCurriculum>
     */
    public function getEducationCurriculums()
    {
        return ($this->educationCurriculums) ? array_values($this->educationCurriculums->toArray()) : new ArrayCollection();
    }
    /**
     * Add member
     *
     * @param EducationCurriculum educationcurriculums
     *
     * @return Jury
     */
    public function addEducationCurriculum(EducationCurriculum $educationCurriculums)
    {
        $this->educationCurriculums[] = $educationCurriculums;

        $educationCurriculums->setEducation($this);
        return $this;
    }
    /**
     * Remove education Curriculums
     *
     * @param EducationCurriculum $educationCurriculums
     */
    public function removeEducationCurriculum(EducationCurriculum $educationCurriculums)
    {
        $this->educationCurriculums->removeElement($educationCurriculums);
    }
    /**
     * Gets cycleByEducations.
     *
     * @return ArrayCollection<CycleByEducation>
     */
    public function getCycleByEducations()
    {
        return ($this->cycleByEducations) ? array_values($this->cycleByEducations->toArray()) : new ArrayCollection();
    }
    /**
     * Add cycleByEducations
     *
     * @param CycleByEducation $cycleByEducations
     *
     * @return CycleByEducation
     */
    public function addCycleByEducation(CycleByEducation $cycleByEducations)
    {
        $this->cycleByEducations[] = $cycleByEducations;

        $cycleByEducations->setEducation($this);
        return $this;
    }
    /**
     * Remove CycleByEducations
     *
     * @param CycleByEducation $cycleByEducations
     */
    public function removeCycleByEducation(CycleByEducation $cycleByEducations)
    {
        $this->cycleByEducations->removeElement($cycleByEducations);
    }
    /**
     * Add course
     *
     * @param \AppBundle\Entity\Booking\Course $course
     *
     * @return Education
     */
    public function addCourse(\AppBundle\Entity\Booking\Course $course)
    {
        $this->courses[] = $course;

        return $this;
    }
    /**
     * Remove course
     *
     * @param \AppBundle\Entity\Booking\Course $course
     */
    public function removeCourse(\AppBundle\Entity\Booking\Course $course)
    {
        $this->courses->removeElement($course);
    }
    /**
     * Get courses
     *
     * @return \Doctrine\Common\Collections\Collection
     */
    public function getCourses()
    {
        return $this->courses;
    }
    /**
     * Add examen
     *
     * @param \AppBundle\Entity\Booking\Examen $examen
     *
     * @return Education
     */
    public function addExamen(\AppBundle\Entity\Booking\Examen $examen)
    {
        $this->examens[] = $examen;

        return $this;
    }
    /**
     * Remove examen
     *
     * @param \AppBundle\Entity\Booking\Examen $examen
     */
    public function removeExamen(\AppBundle\Entity\Booking\Examen $examen)
    {
        $this->examens->removeElement($examen);
    }
    /**
     * Get examens
     *
     * @return \Doctrine\Common\Collections\Collection
     */
    public function getExamens()
    {
        return $this->examens;
    }
    /**
     * Add educationTeacher
     *
     * @param \AppBundle\Entity\Education\EducationTeacher $educationTeacher
     *
     * @return Education
     */
    public function addEducationTeacher(\AppBundle\Entity\Education\EducationTeacher $educationTeacher)
    {
        $this->educationTeachers[] = $educationTeacher;

        return $this;
    }
    /**
     * Remove educationTeacher
     *
     * @param \AppBundle\Entity\Education\EducationTeacher $educationTeacher
     */
    public function removeEducationTeacher(\AppBundle\Entity\Education\EducationTeacher $educationTeacher)
    {
        $this->educationTeachers->removeElement($educationTeacher);
    }
    /**
     * Get educationTeachers
     *
     * @return \Doctrine\Common\Collections\Collection
     */
    public function getEducationTeachers()
    {
        return $this->educationTeachers;
    }
    /**
     * Gets full label.
     *
     * @return array
     */
    public function getFullLabelTemplate()
    {

        return [
            $this->getEducationCategory()->getLabel(),
            $this->getEducationComplementTemplate()

        ];
    }
    /**
     * Gets full label.
     *
     * @return array
     */
    public function getEducationComplementTemplate()
    {

        $educationComplement = $this->getEducationComplement() ? ($this->getEducationComplement()->getName() !== PratiqueEnum::NONE)?$this->getEducationComplement()->getName():'' : '';
        return ['value' => $educationComplement, 'translate' => true];
    }
    /**
     * Set isActive
     *
     * @param boolean $isActive
     *
     * @return Education
     */
    public function setIsActive($isActive)
    {
        $this->isActive = $isActive;

        return $this;
    }
    /**
     * Get isActive
     *
     * @return boolean
     */
    public function getIsActive()
    {
        return $this->isActive;
    }
    /**
     * Add tag
     *
     * @param \AppBundle\Entity\Core\Tagg $tag
     *
     * @return Education
     */
    public function addTag(\AppBundle\Entity\Core\Tagg $tag)
    {
        $this->tags[] = $tag;

        return $this;
    }
    /**
     * Remove tag
     *
     * @param \AppBundle\Entity\Core\Tagg $tag
     */
    public function removeTag(\AppBundle\Entity\Core\Tagg $tag)
    {
        $this->tags->removeElement($tag);
    }
    /**
     * Get tags
     *
     * @return \Doctrine\Common\Collections\Collection
     */
    public function getTags()
    {
        return $this->tags;
    }
    /**
     * Set availablePlacesAccordingToLevel
     *
     * @param boolean $availablePlacesAccordingToLevel
     *
     * @return Education
     */
    public function setAvailablePlacesAccordingToLevel($availablePlacesAccordingToLevel)
    {
        $this->availablePlacesAccordingToLevel = $availablePlacesAccordingToLevel;

        return $this;
    }
    /**
     * Get availablePlacesAccordingToLevel
     *
     * @return boolean
     */
    public function getAvailablePlacesAccordingToLevel()
    {
        return $this->availablePlacesAccordingToLevel;
    }
    /**
     * Set availablePlaces
     *
     * @param integer $availablePlaces
     *
     * @return Education
     */
    public function setAvailablePlaces($availablePlaces)
    {
        $this->availablePlaces = $availablePlaces;

        return $this;
    }
    /**
     * Get availablePlaces
     *
     * @return integer
     */
    public function getAvailablePlaces()
    {
        return $this->availablePlaces;
    }
    /**
     * Set totalAvailablePlaces
     *
     * @param integer $toalAvailablePlaces
     *
     * @return Education
     */
    public function setTotalAvailablePlaces($totalAvailablePlaces)
    {
        $this->totalAvailablePlaces = $totalAvailablePlaces;

        return $this;
    }
    /**
     * Get totalAvailablePlaces
     *
     * @return integer
     */
    public function getTotalAvailablePlaces()
    {
        return $this->totalAvailablePlaces;
    }
    /**
     * Set totalEducationStudents
     *
     * @param integer $totalEducationStudents
     *
     * @return Education
     */
    public function setTotalEducationStudents($totalEducationStudents)
    {
        $this->totalEducationStudents = $totalEducationStudents;

        return $this;
    }
    /**
     * Get totalEducationStudents
     *
     * @return integer
     */
    public function getTotalEducationStudents()
    {
        return $this->totalEducationStudents;
    }
    /**
     * Set $totalPendingRegistrations
     *
     * @param integer $totalPendingRegistrations
     *
     * @return Education
     */
    public function setTotalPendingRegistrations($totalPendingRegistrations)
    {
        $this->totalPendingRegistrations = $totalPendingRegistrations;

        return $this;
    }
    /**
     * Get totalPendingRegistrations
     *
     * @return integer
     */
    public function getTotalPendingRegistrations()
    {
        return $this->totalPendingRegistrations;
    }
    /**
     * Set $totalPotentialRegistrations
     *
     * @param integer $totalPotentialRegistrations
     *
     * @return Education
     */
    public function setTotalPotentialRegistrations($totalPotentialRegistrations)
    {
        $this->totalPotentialRegistrations = $totalPotentialRegistrations;

        return $this;
    }
    /**
     * Get totalPotentialRegistrations
     *
     * @return integer
     */
    public function getTotalPotentialRegistrations()
    {
        return $this->totalPotentialRegistrations;
    }
    /**
     * Set $fillingRate
     *
     * @param integer $fillingRate
     *
     * @return Education
     */
    public function setFillingRate($fillingRate)
    {
        $this->fillingRate = $fillingRate;

        return $this;
    }
    /**
     * Get $fillingRate
     *
     * @return integer
     */
    public function getFillingRate()
    {
        return $this->fillingRate;
    }
    /**
     * Set $averageFillingRate
     *
     * @param integer $averageFillingRate
     *
     * @return Education
     */
    public function setAverageFillingRate($averageFillingRate)
    {
        $this->averageFillingRate = $averageFillingRate;

        return $this;
    }
    /**
     * Get $averageFillingRate
     *
     * @return integer
     */
    public function getAverageFillingRate()
    {
        return $this->averageFillingRate;
    }
    /**
     * Set $potentialFillingRate
     *
     * @param integer $potentialFillingRate
     *
     * @return Education
     */
    public function setPotentialFillingRate($potentialFillingRate)
    {
        $this->potentialFillingRate = $potentialFillingRate;

        return $this;
    }
    /**
     * Get $potentialFillingRate
     *
     * @return integer
     */
    public function getPotentialFillingRate()
    {
        return $this->potentialFillingRate;
    }
    /**
     * Set description
     *
     * @param string $description
     *
     * @return Education
     */
    public function setDescription($description)
    {
        $this->description = $description;

        return $this;
    }
    /**
     * Get description
     *
     * @return string
     */
    public function getDescription()
    {
        return $this->description;
    }
    /**
     * Set educationalTarget
     *
     * @param string $educationalTarget
     *
     * @return Education
     */
    public function setEducationalTarget($educationalTarget)
    {
        $this->educationalTarget = $educationalTarget;

        return $this;
    }
    /**
     * Get educationalTarget
     *
     * @return string
     */
    public function getEducationalTarget()
    {
        return $this->educationalTarget;
    }
    /**
     * Set educationalContent
     *
     * @param string $educationalContent
     *
     * @return Education
     */
    public function setEducationalContent($educationalContent)
    {
        $this->educationalContent = $educationalContent;

        return $this;
    }
    /**
     * Get educationalContent
     *
     * @return string
     */
    public function getEducationalContent()
    {
        return $this->educationalContent;
    }
    /**
     * Set howToEvaluate
     *
     * @param string $howToEvaluate
     *
     * @return Education
     */
    public function setHowToEvaluate($howToEvaluate)
    {
        $this->howToEvaluate = $howToEvaluate;

        return $this;
    }
    /**
     * Get howToEvaluate
     *
     * @return string
     */
    public function getHowToEvaluate()
    {
        return $this->howToEvaluate;
    }
    /**
     * Set prerequisite
     *
     * @param string $prerequisite
     *
     * @return Education
     */
    public function setPrerequisite($prerequisite)
    {
        $this->prerequisite = $prerequisite;

        return $this;
    }
    /**
     * Get prerequisite
     *
     * @return string
     */
    public function getPrerequisite()
    {
        return $this->prerequisite;
    }
}
