<?php
declare(strict_types=1);

namespace App\Entity\AccessWish;

use App\Entity\Access\Access;
use App\Entity\Core\Country;
use App\Entity\Core\File;
use App\Entity\Core\Tagg;
use App\Entity\Organization\Organization;
//use DH\Auditor\Provider\Doctrine\Auditing\Annotation\Auditable;
use Doctrine\Common\Collections\ArrayCollection;
use Doctrine\ORM\Mapping as ORM;
use Doctrine\Common\Collections\Collection;

/**
 * Classe ... qui ...
 */
//#[Auditable]
#[ORM\Entity]
class AccessWish
{
    #[ORM\Id]
    #[ORM\Column]
    #[ORM\GeneratedValue]
    private ?int $id = null;

    #[ORM\ManyToOne]
    #[ORM\JoinColumn(nullable: false)]
    private Organization $organization;

    #[ORM\ManyToOne(cascade: ['persist'], inversedBy: 'accessWishes')]
    #[ORM\JoinColumn(onDelete: 'CASCADE')]
    private Access $accessOriginal;

    #[ORM\ManyToOne(inversedBy: 'accessWishes')]
    private AccessFamilyWish $accessFamilyWish;

    #[ORM\ManyToOne]
    #[ORM\JoinColumn(referencedColumnName: 'id', nullable: false,  onDelete: 'SET NULL')]
    private File $image;

    #[ORM\ManyToOne]
    private Country $addressCountry;

    #[ORM\OneToMany(mappedBy: 'accessWish', targetEntity: EducationStudentWish::class, cascade: ['persist'], orphanRemoval: true)]
    private Collection $educationStudentWishes;

    #[ORM\OneToMany(mappedBy: 'accessWishReregistrations', targetEntity: EducationStudentWish::class, cascade: ['persist'], orphanRemoval: true)]
    private Collection $educationStudentReregistrationsWishes;

    #[ORM\OneToMany(mappedBy: 'accessWish', targetEntity: DocumentWish::class, cascade: ['persist'])]
    private Collection $documentWishes;

    #[ORM\ManyToMany(targetEntity: Tagg::class, inversedBy: 'accessWishes', cascade: ['persist'])]
    #[ORM\JoinTable(name: 'tag_accessWish')]
    #[ORM\JoinColumn(name: 'accessWish_id', referencedColumnName: 'id')]
    #[ORM\InverseJoinColumn(name: 'tag_id', referencedColumnName: 'id')]
    private Collection $tags;

    public function __construct()
    {
        $this->educationStudentWishes = new ArrayCollection();
        $this->educationStudentReregistrationsWishes = new ArrayCollection();
        $this->documentWishes = new ArrayCollection();
        $this->tags = new ArrayCollection();
    }

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

    public function getOrganization(): ?Organization
    {
        return $this->organization;
    }

    public function setOrganization(?Organization $organization): self
    {
        $this->organization = $organization;

        return $this;
    }

    public function getAccessOriginal(): ?Access
    {
        return $this->accessOriginal;
    }

    public function setAccessOriginal(?Access $accessOriginal): self
    {
        $this->accessOriginal = $accessOriginal;

        return $this;
    }

    public function getAccessFamilyWish(): ?AccessFamilyWish
    {
        return $this->accessFamilyWish;
    }

    public function setAccessFamilyWish(?AccessFamilyWish $accessFamilyWish): self
    {
        $this->accessFamilyWish = $accessFamilyWish;

        return $this;
    }

    public function getImage(): ?File
    {
        return $this->image;
    }

    public function setImage(?File $image): self
    {
        $this->image = $image;

        return $this;
    }

    public function getAddressCountry(): ?Country
    {
        return $this->addressCountry;
    }

    public function setAddressCountry(?Country $addressCountry): self
    {
        $this->addressCountry = $addressCountry;

        return $this;
    }

    /**
     * @return Collection<int, EducationStudentWish>
     */
    public function getEducationStudentWishes(): Collection
    {
        return $this->educationStudentWishes;
    }

    public function addEducationStudentWish(EducationStudentWish $educationStudentWish): self
    {
        if (!$this->educationStudentWishes->contains($educationStudentWish)) {
            $this->educationStudentWishes[] = $educationStudentWish;
            $educationStudentWish->setAccessWish($this);
        }

        return $this;
    }

    public function removeEducationStudentWish(EducationStudentWish $educationStudentWish): self
    {
        if ($this->educationStudentWishes->removeElement($educationStudentWish)) {
            // set the owning side to null (unless already changed)
            if ($educationStudentWish->getAccessWish() === $this) {
                $educationStudentWish->setAccessWish(null);
            }
        }

        return $this;
    }

    /**
     * @return Collection<int, EducationStudentWish>
     */
    public function getEducationStudentReregistrationsWishes(): Collection
    {
        return $this->educationStudentReregistrationsWishes;
    }

    public function addEducationStudentReregistrationsWish(EducationStudentWish $educationStudentReregistrationsWish): self
    {
        if (!$this->educationStudentReregistrationsWishes->contains($educationStudentReregistrationsWish)) {
            $this->educationStudentReregistrationsWishes[] = $educationStudentReregistrationsWish;
            $educationStudentReregistrationsWish->setAccessWishReregistrations($this);
        }

        return $this;
    }

    public function removeEducationStudentReregistrationsWish(EducationStudentWish $educationStudentReregistrationsWish): self
    {
        if ($this->educationStudentReregistrationsWishes->removeElement($educationStudentReregistrationsWish)) {
            // set the owning side to null (unless already changed)
            if ($educationStudentReregistrationsWish->getAccessWishReregistrations() === $this) {
                $educationStudentReregistrationsWish->setAccessWishReregistrations(null);
            }
        }

        return $this;
    }

    /**
     * @return Collection<int, DocumentWish>
     */
    public function getDocumentWishes(): Collection
    {
        return $this->documentWishes;
    }

    public function addDocumentWish(DocumentWish $documentWish): self
    {
        if (!$this->documentWishes->contains($documentWish)) {
            $this->documentWishes[] = $documentWish;
            $documentWish->setAccessWish($this);
        }

        return $this;
    }

    public function removeDocumentWish(DocumentWish $documentWish): self
    {
        if ($this->documentWishes->removeElement($documentWish)) {
            // set the owning side to null (unless already changed)
            if ($documentWish->getAccessWish() === $this) {
                $documentWish->setAccessWish(null);
            }
        }

        return $this;
    }

    /**
     * @return Collection<int, Tagg>
     */
    public function getTags(): Collection
    {
        return $this->tags;
    }

    public function addTag(Tagg $tag): self
    {
        if (!$this->tags->contains($tag)) {
            $this->tags[] = $tag;
        }

        return $this;
    }

    public function removeTag(Tagg $tag): self
    {
        $this->tags->removeElement($tag);

        return $this;
    }
}