<?php

declare(strict_types=1);

namespace App\Entity\Education;

// use DH\Auditor\Provider\Doctrine\Auditing\Annotation\Auditable;
use ApiPlatform\Metadata\ApiResource;
use Doctrine\Common\Collections\ArrayCollection;
use Doctrine\Common\Collections\Collection;
use Doctrine\ORM\Mapping as ORM;

/**
 * Complément d'information lié à la catégorie EducationCategory d'un enseignement Education.
 */
// #[Auditable]
#[ApiResource(operations: [])]
#[ORM\Entity]
class EducationComplement
{
    #[ORM\Id]
    #[ORM\Column]
    #[ORM\GeneratedValue]
    private ?int $id = null;

    /** @var Collection<int, Education> */
    #[ORM\OneToMany(targetEntity: Education::class, mappedBy: 'educationComplement', cascade: [], orphanRemoval: true)]
    protected Collection $educations;

    public function __construct()
    {
        $this->educations = new ArrayCollection();
    }

    public function getId(): ?int
    {
        return $this->id;
    }

    public function getEducations(): Collection
    {
        return $this->educations;
    }

    public function addEducation(Education $education): self
    {
        if (!$this->educations->contains($education)) {
            $this->educations[] = $education;
            $education->setEducationComplement($this);
        }

        return $this;
    }

    public function removeEducation(Education $education): self
    {
        if ($this->educations->removeElement($education)) {
            $education->setEducationComplement(null);
        }

        return $this;
    }
}
