<?php

namespace AppBundle\Entity\Education;

use AppBundle\Entity\Organization\Organization;
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;
use AppBundle\Annotation\DefaultField;

/**
 * Critère d'évaluation permettant de définir un suivi pédagogique EducationNotation
 *
 * @Iri("http://schema.org/CriteriaNotation")
 */
#[ORM\Entity]
class CriteriaNotation
{
    use TimestampableEntity;
    use CreatorUpdaterEntity;
    /**
     * @var int
     */
    #[ORM\Column(type: 'integer')]
    #[ORM\Id]
    #[ORM\GeneratedValue(strategy: 'AUTO')]
    #[Groups(['criterianotation', 'report_card_educationstudent', 'educationnotation_list', 'criteria_notations_list'])]
    private $id;
    /**
     * @var Organization
     *
     * @DefaultField
     */
    #[ORM\ManyToOne(targetEntity: 'AppBundle\Entity\Organization\Organization', inversedBy: 'critereNotations')]
    #[ORM\JoinColumn(nullable: false)]
    #[Assert\NotNull]
    #[Groups(['criterianotation'])]
    private $organization;
    /**
     * @var string
     */
    #[ORM\Column(type: 'string')]
    #[Assert\Type(type: 'string')]
    #[Assert\NotNull]
    #[Groups(['criterianotation', 'criterianotation_reference', 'report_card_educationstudent', 'educationnotation_list_criterianotation', 'education_input_list_educationnotations', 'criteria_notations_list'])]
    private $label;
    /**
     * @var string
     */
    #[ORM\Column(type: 'text', nullable: true)]
    #[Assert\Type(type: 'string')]
    #[Groups(['criterianotation'])]
    private $description;
    /**
     * @var ArrayCollection<EducationNotation>
     */
    #[ORM\OneToMany(targetEntity: 'AppBundle\Entity\Education\EducationNotation', mappedBy: 'criteriaNotation')]
    #[Groups(['criterianotation_educationnotation'])]
    private $educationNotations;
    /**
     * @var bool
     */
    #[ORM\Column(type: 'boolean', options: ['default' => true])]
    #[Assert\Type(type: 'boolean')]
    #[Assert\NotNull]
    #[Groups(['criterianotation', 'criterianotation_reference', 'criteria_notations_list'])]
    private $isActive = true;
    /**
     * @var string
     */
    #[ORM\Column(type: 'string', nullable: true)]
    #[Assert\Choice(callback: ['\AppBundle\Enum\Education\TypeCriteriaEnum', 'toArray'], multiple: false)]
    #[Groups(['criterianotation', 'criterianotation_reference', 'educationnotation_list_criterianotation', 'report_card_educationstudent', 'criteria_notations_list'])]
    private $type;
    /**
     * @var int
     */
    #[ORM\Column(type: 'integer', nullable: true)]
    #[Assert\Type(type: 'integer', message: 'invalid-integer')]
    #[Assert\GreaterThanOrEqual(value: 0)]
    #[Assert\LessThanOrEqual(value: 100, message: 'lessThanOrEqual100')]
    #[Groups(['criterianotation', 'criterianotation_reference', 'report_card_educationstudent', 'educationnotation_list_criterianotation', 'criteria_notations_list'])]
    private $noteMax;
    /**
     * @var ArrayCollection<EducationNotation>
     */
    #[ORM\OneToMany(targetEntity: 'AppBundle\Entity\Education\CustomNotation', mappedBy: 'criteriaNotation', orphanRemoval: true, cascade: ['persist', 'remove'])]
    #[Groups(['criterianotation', 'criterianotation_reference', 'criteria_notations_list'])]
    private $customNotation;
    /**
     * @var ArrayCollection<EducationNotationCriteriaConfig>
     */
    #[ORM\OneToMany(targetEntity: 'AppBundle\Entity\Education\EducationNotationCriteriaConfig', mappedBy: 'criteriaNotation', orphanRemoval: true, cascade: ['persist', 'remove'])]
    #[Groups(['educationnotationconfig'])]
    private $educationNotationCriteriaConfigs;
    /**
     * Constructor
     */
    public function __construct()
    {
        $this->educationNotations = new ArrayCollection();
        $this->customNotation = new ArrayCollection();
        $this->educationNotationCriteriaConfigs = 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 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 description.
     *
     * @param string $description
     *
     * @return $this
     */
    public function setDescription($description)
    {
        $this->description = $description;

        return $this;
    }
    /**
     * Gets description.
     *
     * @return string
     */
    public function getDescription()
    {
        return $this->description;
    }
    /**
     * Add educationNotation
     *
     * @param \AppBundle\Entity\Education\EducationNotation $educationNotation
     *
     * @return CriteriaNotation
     */
    public function addEducationNotation(\AppBundle\Entity\Education\EducationNotation $educationNotation)
    {
        $this->educationNotations[] = $educationNotation;

        return $this;
    }
    /**
     * Remove educationNotation
     *
     * @param \AppBundle\Entity\Education\EducationNotation $educationNotation
     */
    public function removeEducationNotation(\AppBundle\Entity\Education\EducationNotation $educationNotation)
    {
        $this->educationNotations->removeElement($educationNotation);
    }
    /**
     * Get educationNotations
     *
     * @return \Doctrine\Common\Collections\Collection
     */
    public function getEducationNotations()
    {
        return $this->educationNotations;
    }
    /**
     * Set isActive
     *
     * @param boolean $isActive
     *
     * @return CriteriaNotation
     */
    public function setIsActive($isActive)
    {
        $this->isActive = $isActive;

        return $this;
    }
    /**
     * Get isActive
     *
     * @return boolean
     */
    public function getIsActive()
    {
        return $this->isActive;
    }
    /**
     * @return string
     */
    public function getType()
    {
        return $this->type;
    }
    /**
     * @param string $type
     */
    public function setType($type)
    {
        $this->type = $type;
    }
    /**
     * @return int
     */
    public function getNoteMax()
    {
        return $this->noteMax;
    }
    /**
     * @param int $noteMax
     */
    public function setNoteMax($noteMax)
    {
        $this->noteMax = $noteMax;
    }
    /**
     * @return CustomNotation
     */
    public function getCustomNotation()
    {
        return $this->customNotation;
    }
    /**
     * Add customNotation
     *
     * @param CustomNotation $customNotation
     *
     * @return CriteriaNotation
     */
    public function addCustomNotation(CustomNotation $customNotation)
    {
        $customNotation->setCriteriaNotation($this);
        $this->customNotation[] = $customNotation;

        return $this;
    }
    /**
     * Remove customNotation
     *
     * @param CustomNotation $customNotation
     */
    public function removeCustomNotation(CustomNotation $customNotation)
    {
        $customNotation->setCriteriaNotation(null);
        $this->customNotation->removeElement($customNotation);
    }
    /**
     * @return ArrayCollection<EducationNotationCriteriaConfig>
     *
     */
    public function getEducationNotationCriteriaConfigs()
    {
        return $this->educationNotationCriteriaConfigs;
    }
    /**
     * Add educationNotationCriteriaConfig
     *
     * @param EducationNotationCriteriaConfig $educationNotationCriteriaConfigs
     *
     * @return CriteriaNotation
     */
    public function addEducationNotationCriteriaConfig(EducationNotationCriteriaConfig $educationNotationCriteriaConfigs)
    {
        $educationNotationCriteriaConfigs->setCriteriaNotation($this);
        $this->educationNotationCriteriaConfigs[] = $educationNotationCriteriaConfigs;

        return $this;
    }
    /**
     * Remove educationNotationCriteriaConfig
     *
     * @param EducationNotationCriteriaConfig $educationNotationCriteriaConfigs
     */
    public function removeEducationNotationCriteriaConfig(EducationNotationCriteriaConfig $educationNotationCriteriaConfigs)
    {
        $educationNotationCriteriaConfigs->setCriteriaNotation(null);
        $this->educationNotationCriteriaConfigs->removeElement($educationNotationCriteriaConfigs);
    }
}
