<?php

/**
 * This file is auto-generated.
 */

declare(strict_types=1);

namespace App\Entity\Education;

use ApiPlatform\Metadata\ApiResource;
use Doctrine\Common\Collections\ArrayCollection;
use Doctrine\Common\Collections\Collection;
use Doctrine\ORM\Mapping as ORM;

#[ApiResource(operations: [])]
#[ORM\Entity]
class RequiredChoicesBlock
{
    #[ORM\Id]
    #[ORM\Column]
    #[ORM\GeneratedValue]
    private int $id;

    #[ORM\ManyToOne(targetEntity: EducationCurriculumPack::class, inversedBy: 'requiredChoicesBlocks')]
    #[ORM\JoinColumn(nullable: false)]
    protected EducationCurriculumPack $educationCurriculumPack;

    /** @var Collection<int, EducationCurriculum> */
    #[ORM\ManyToMany(
        targetEntity: EducationCurriculum::class,
        inversedBy: 'requiredChoicesEducationCurriculumPacks',
        cascade: [],
        orphanRemoval: false,
    )]
    #[ORM\JoinTable(name: 'requiredChoicesBlock_educationCurriculum')]
    #[ORM\JoinColumn(name: 'requiredchoicesblock_id', onDelete: 'CASCADE')]
    #[ORM\InverseJoinColumn(name: 'educationcurriculum_id', onDelete: 'CASCADE')]
    protected Collection $requiredChoicesEducationCurriculums;

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

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

    public function setId(int $id): self
    {
        $this->id = $id;

        return $this;
    }

    public function getEducationCurriculumPack(): EducationCurriculumPack
    {
        return $this->educationCurriculumPack;
    }

    public function setEducationCurriculumPack(EducationCurriculumPack $educationCurriculumPack): self
    {
        $this->educationCurriculumPack = $educationCurriculumPack;

        return $this;
    }

    public function getRequiredChoicesEducationCurriculum(): Collection
    {
        return $this->requiredChoicesEducationCurriculums;
    }

    public function addRequiredChoicesEducationCurriculum(EducationCurriculum $educationCurriculum): self
    {
        if (!$this->requiredChoicesEducationCurriculums->contains($educationCurriculum)) {
            $this->requiredChoicesEducationCurriculums[] = $educationCurriculum;
            $educationCurriculum->addRequiredChoicesEducationCurriculumPack($this);
        }

        return $this;
    }

    public function removeRequiredChoicesEducationCurriculum(EducationCurriculum $educationCurriculum): self
    {
        if ($this->requiredChoicesEducationCurriculums->removeElement($educationCurriculum)) {
            $educationCurriculum->removeRequiredChoicesEducationCurriculumPack($this);
        }

        return $this;
    }
}
