<?php

namespace AppBundle\Entity\Education;

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;

/**
 * Configuration des critère pour la grille d'évaluation
 */
#[ORM\Entity]
class EducationNotationCriteriaConfig
{
    use TimestampableEntity;
    use CreatorUpdaterEntity;
    /**
     * @var int
     */
    #[ORM\Column(type: 'integer')]
    #[ORM\Id]
    #[ORM\GeneratedValue(strategy: 'AUTO')]
    #[Groups(['educationnotationcriteriaconfig'])]
    private $id;
    /**
     * @var EducationNotationConfig
     */
    #[ORM\ManyToOne(targetEntity: 'AppBundle\Entity\Education\EducationNotationConfig', inversedBy: 'educationNotationCriteriaConfigs')]
    #[Groups(['educationnotationcriteriaconfig', 'report_card_educationstudent'])]
    private $educationNotationConfig;
    /**
     * @var CriteriaNotation
     */
    #[ORM\ManyToOne(targetEntity: 'AppBundle\Entity\Education\CriteriaNotation', inversedBy: 'educationNotationCriteriaConfigs')]
    #[ORM\JoinColumn(referencedColumnName: 'id', nullable: false)]
    #[Groups(['educationnotationcriteriaconfig'])]
    private $criteriaNotation;
    /**
     * @var int
     */
    #[ORM\Column(type: 'integer', options: ['default' => 1])]
    #[Assert\Range(min: 1, max: 10)]
    #[Assert\Type(type: 'integer', message: 'invalid-integer')]
    #[Groups(['educationnotationcriteriaconfig', 'report_card_educationstudent'])]
    private $coefficient = 1;
    /**
     * @var ArrayCollection<EducationNotation>
     */
    #[ORM\OneToMany(targetEntity: 'AppBundle\Entity\Education\EducationNotation', mappedBy: 'criteriaNotationConfig')]
    #[Groups(['educationnotationcriteriaconfig'])]
    private $educationNotations;
    public function __construct() {
        $this->educationNotations = 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 criteriaNotation.
     *
     * @param CriteriaNotation $criteriaNotation
     *
     * @return $this
     */
    public function setCriteriaNotation($criteriaNotation)
    {
        $this->criteriaNotation = $criteriaNotation;

        return $this;
    }
    /**
     * Gets criteriaNotation.
     *
     * @return CriteriaNotation
     */
    public function getCriteriaNotation()
    {
        return $this->criteriaNotation;
    }
    /**
     * Sets educationNotationConfig.
     *
     * @param EducationNotationConfig $educationNotationConfig
     *
     * @return $this
     */
    public function setEducationNotationConfig($educationNotationConfig)
    {
        $this->educationNotationConfig = $educationNotationConfig;

        return $this;
    }
    /**
     * Gets criteriaNotation.
     *
     * @return EducationNotationConfig
     */
    public function getEducationNotationConfig()
    {
        return $this->educationNotationConfig;
    }
    /**
     * 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 coefficient.
     *
     * @param int $coefficient
     *
     * @return $this
     */
    public function setCoefficient($coefficient)
    {
        if($coefficient === null) $coefficient = 1;
        $this->coefficient = $coefficient;

        return $this;
    }
    /**
     * Gets coefficient.
     *
     * @return int
     */
    public function getCoefficient()
    {
        return $this->coefficient;
    }
    /**
     * Add educationNotation
     *
     * @param \AppBundle\Entity\Education\EducationNotation $educationNotation
     *
     * @return EducationNotationCriteriaConfig
     */
    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;
    }
}
