<?php
declare (strict_types=1);

namespace App\Entity\Access;

use ApiPlatform\Metadata\ApiResource;
use ApiPlatform\Doctrine\Orm\Filter\BooleanFilter;
use ApiPlatform\Metadata\ApiFilter;
use App\Entity\AccessWish\AccessWish;
use App\Entity\Billing\AccessBilling;
use App\Entity\Billing\AccessFictionalIntangible;
use App\Entity\Billing\Bill;
use App\Entity\Billing\BillCredit;
use App\Entity\Billing\BillLine;
use App\Entity\Billing\EducationalProjectPayer;
use App\Entity\Booking\Attendance;
use App\Entity\Booking\AttendanceBooking;
use App\Entity\Booking\Course;
use App\Entity\Booking\EducationalProject;
use App\Entity\Booking\Event;
use App\Entity\Booking\EventUser;
use App\Entity\Booking\ExamenConvocation;
use App\Entity\Booking\PersonHoliday;
use App\Entity\Booking\WorkByUser;
use App\Entity\Core\Tagg;
use App\Entity\Donor\Donor;
use App\Entity\Education\EducationNotationConfig;
use App\Entity\Education\EducationStudent;
use App\Entity\Education\EducationTeacher;
use App\Entity\Message\Email;
use App\Entity\Message\Mail;
use App\Entity\Message\Sms;
use App\Entity\Organization\Jury;
use App\Entity\Organization\Parameters;
use App\Entity\Person\CommissionMember;
use App\Entity\Person\CompanyPerson;
use App\Entity\Person\Medal;
use App\Entity\Product\Equipment;
use App\Entity\Product\EquipmentLoan;
use App\Filter\Person\FullNameFilter;
use App\Entity\Billing\AccessIntangible;
use App\Entity\Billing\AccessPayer;
use App\Entity\Core\Notification;
use App\Entity\Core\NotificationUser;
use App\Entity\Organization\Organization;
use App\Entity\Organization\OrganizationLicence;
use App\Filter\Utils\InFilter;
use App\Repository\Access\AccessRepository;
use App\Entity\Person\Person;
use App\Entity\Person\PersonActivity;
use App\Entity\Place\PlaceRepair;
use App\Entity\Place\RoomRepair;
use App\Entity\Product\EquipmentRepair;
//use DH\Auditor\Provider\Doctrine\Auditing\Annotation\Auditable;
use Doctrine\Common\Collections\ArrayCollection;
use Doctrine\Common\Collections\Collection;
use Doctrine\ORM\Mapping as ORM;
use JetBrains\PhpStorm\Pure;
use Symfony\Component\Security\Core\Role\Role;
use Symfony\Component\Security\Core\User\PasswordAuthenticatedUserInterface;
use Symfony\Component\Security\Core\User\UserInterface;
use Symfony\Component\Serializer\Annotation\Groups;

/**
 * Fais le lien entre une Person et une Organization
 * @see : config/api_platform/Access/access.yaml
 */
#[ApiResource]
//#[Auditable]
#[ORM\Entity(repositoryClass: AccessRepository::class)]
#[ApiFilter(filterClass: BooleanFilter::class, properties: ['person.isPhysical'])]
#[ApiFilter(filterClass: FullNameFilter::class)]
#[ApiFilter(filterClass: InFilter::class, properties: ['id'])]
class Access implements UserInterface, PasswordAuthenticatedUserInterface
{
    #[ORM\Id]
    #[ORM\Column]
    #[ORM\GeneratedValue]
    #[Groups("access_people_ref")]
    private ?int $id = null;

    #[ORM\Column(options: ['default' => false])]
    private bool $adminAccess = false;

    #[ORM\Column(options: ['default' => false])]
    #[Groups(['private'])]
    private bool $superAdminAccess = false;

    #[ORM\Column(nullable: true)]
    #[Groups(['my_access:input'])]
    private ?int $activityYear = null;

    #[ORM\ManyToOne(cascade: ['persist'], inversedBy: 'access')]
    #[ORM\JoinColumn(nullable: false)]
    #[Groups(["access_people_ref", "access_address"])]
    private Person $person;

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

    /** @var mixed[]|null  */
    #[ORM\Column(type: 'json', length: 4294967295, nullable: true)]
    private ?array $roles = [];

    /** @var mixed[]|null  */
    #[Groups(['my_access:input'])]
    #[ORM\Column(type: 'json', length: 4294967295, nullable: true)]
    private ?array $setting = [];

    #[ORM\OneToOne(mappedBy: 'access', cascade: ['persist'], orphanRemoval: true)]
    private AccessBilling $accessBilling;

    #[ORM\OneToMany(mappedBy: 'access', targetEntity: PersonActivity::class, cascade: ['persist'], orphanRemoval: true)]
    private Collection $personActivity;

    #[ORM\OneToMany(mappedBy: 'access', targetEntity: OrganizationFunction::class, cascade: ['persist'], orphanRemoval: true)]
    private Collection $organizationFunction;

    #[ORM\OneToMany(mappedBy: 'licensee', targetEntity: OrganizationLicence::class, cascade: ['persist'], orphanRemoval: true)]
    private Collection $organizationLicences;

    #[ORM\OneToMany(mappedBy: 'access', targetEntity: PersonalizedList::class, cascade: ['persist'], orphanRemoval: true)]
    private Collection $personalizedLists;

    #[ORM\OneToMany(mappedBy: 'recipientAccess', targetEntity: Notification::class, orphanRemoval: true)]
    private Collection $notifications;

    #[ORM\OneToMany(mappedBy: 'access', targetEntity: NotificationUser::class, orphanRemoval: true)]
    private Collection $notificationUsers;

    #[ORM\ManyToMany(targetEntity: Access::class, mappedBy: 'children', cascade: ['persist'])]
    private Collection $guardians;

    #[ORM\ManyToMany(targetEntity: Access::class, inversedBy: 'guardians', cascade: ['persist'])]
    #[ORM\JoinTable(name: 'children_guardians')]
    #[ORM\JoinColumn(name: 'guardians_id', referencedColumnName: 'id')]
    #[ORM\InverseJoinColumn(name: 'children_id', referencedColumnName: 'id')]
    private Collection $children;

    #[ORM\OneToMany(mappedBy: 'accessPayer', targetEntity: AccessPayer::class, cascade: ['persist'], orphanRemoval: true)]
    private Collection $billingPayers;

    #[ORM\OneToMany(mappedBy: 'accessReceiver', targetEntity: AccessPayer::class, cascade: ['persist'], orphanRemoval: true)]
    private Collection $billingReceivers;

    #[ORM\OneToMany(mappedBy: 'access', targetEntity: AccessIntangible::class, cascade: ['persist'], orphanRemoval: true)]
    private Collection $accessIntangibles;

    #[ORM\ManyToOne(inversedBy: 'publicationDirectors')]
    #[ORM\JoinColumn(referencedColumnName: 'id', nullable: false)]
    private ?Parameters $publicationDirector;

    #[ORM\ManyToOne(inversedBy: 'teachers')]
    #[ORM\JoinColumn(referencedColumnName: 'id', nullable: true, onDelete: 'SET NULL')]
    private ?EducationNotationConfig $educationNotationConfig;

    #[ORM\OneToMany(mappedBy: 'company', targetEntity: CompanyPerson::class, cascade: ['persist'], orphanRemoval: true)]
    private Collection $companyPersonAccesses;

    #[ORM\OneToMany(mappedBy: 'access', targetEntity: CompanyPerson::class, cascade: ['persist'], orphanRemoval: true)]
    private Collection $companyPersonCompany;

    #[ORM\OneToMany(mappedBy: 'access', targetEntity: EducationStudent::class, cascade: ['persist'], orphanRemoval: true)]
    private Collection $educationStudent;

    #[ORM\ManyToMany(targetEntity: EducationStudent::class, mappedBy: 'teachers', cascade: ['persist'], orphanRemoval: true)]
    private Collection $educationStudentByTeacher;

    #[ORM\OneToMany(mappedBy: 'teacher', targetEntity: EducationTeacher::class, orphanRemoval: true)]
    private Collection $educationTeachers;

    #[ORM\OneToMany(mappedBy: 'access', targetEntity: PersonHoliday::class, cascade: ['persist'], orphanRemoval: true)]
    private Collection $holidays;

    #[ORM\ManyToMany(targetEntity: Course::class, mappedBy: 'students', cascade: ['persist'])]
    private Collection $courses;

    #[ORM\ManyToMany(targetEntity: Course::class, mappedBy: 'organizer', cascade: ['persist'])]
    private Collection $practicalCourses;

    #[ORM\ManyToMany(targetEntity: Event::class, mappedBy: 'organizer', cascade: ['persist'])]
    private Collection $eventOrganizers;

    #[ORM\ManyToMany(targetEntity: EducationalProject::class, mappedBy: 'organizer', cascade: ['persist'])]
    private Collection $educationalProjectOrganizers;

    #[ORM\ManyToOne(cascade: ['persist'], inversedBy: 'accesses')]
    #[ORM\JoinColumn(referencedColumnName: 'id', nullable: false, onDelete: "SET NULL")]
    private AccessFamily $accessFamily;

    #[ORM\OneToMany(mappedBy: 'educationalProjectPayer', targetEntity: EducationalProjectPayer::class, cascade: ['persist'], orphanRemoval: true)]
    private Collection $billingEducationalProjectPayers;

    #[ORM\OneToMany(mappedBy: 'access', targetEntity: Bill::class, orphanRemoval: true)]
    private Collection $bills;

    #[ORM\OneToMany(mappedBy: 'access', targetEntity: BillLine::class, orphanRemoval: true)]
    private Collection $billLines;

    #[ORM\OneToMany(mappedBy: 'access', targetEntity: BillCredit::class, orphanRemoval: true)]
    private Collection $billCredits;

    #[ORM\OneToMany(mappedBy: 'silentPartner', targetEntity: EducationalProject::class)]
    private Collection $silentPartners;

    #[ORM\OneToMany(mappedBy: 'operationalPartner', targetEntity: EducationalProject::class)]
    private Collection $operationalPartners;

    #[ORM\OneToMany(mappedBy: 'guest', targetEntity: EventUser::class, orphanRemoval: true)]
    private Collection $eventUsers;

    #[ORM\OneToMany(mappedBy: 'student', targetEntity: ExamenConvocation::class, orphanRemoval: true)]
    private Collection $examenConvocations;

    #[ORM\OneToMany(mappedBy: 'provider', targetEntity: EquipmentRepair::class)]
    private Collection $equipmentRepairProviders;

    #[ORM\OneToMany(mappedBy: 'access', targetEntity: Attendance::class, orphanRemoval: true)]
    private Collection $attendances;

    #[ORM\OneToMany(mappedBy: 'access', targetEntity: AttendanceBooking::class, orphanRemoval: true)]
    private Collection $attendanceBookings;

    #[ORM\OneToMany(mappedBy: 'replacement', targetEntity: Attendance::class)]
    private Collection $attendanceReplacements;

    #[ORM\OneToMany(mappedBy: 'provider', targetEntity: RoomRepair::class)]
    private Collection $roomRepairProviders;

    #[ORM\OneToMany(mappedBy: 'provider', targetEntity: PlaceRepair::class)]
    private Collection $placeRepairProviders;

    #[ORM\OneToMany(mappedBy: 'author', targetEntity: Email::class)]
    private Collection $emails;

    #[ORM\OneToMany(mappedBy: 'author', targetEntity: Mail::class)]
    private Collection $mails;

    #[ORM\OneToMany(mappedBy: 'author', targetEntity: Sms::class)]
    private Collection $sms;

    #[ORM\ManyToMany(targetEntity: Jury::class, mappedBy: 'members', orphanRemoval: true)]
    private Collection $juryMembers;

    #[ORM\OneToMany(mappedBy: 'contactPerson', targetEntity: Organization::class)]
    private Collection $organizationContacts;

    #[ORM\OneToMany(mappedBy: 'member', targetEntity: CommissionMember::class, orphanRemoval: true)]
    private Collection $commissionMembers;

    #[ORM\OneToMany(mappedBy: 'supplier', targetEntity: Equipment::class)]
    private Collection $equipmentSuppliers;

    #[ORM\OneToMany(mappedBy: 'controlManager', targetEntity: Equipment::class)]
    private Collection $equipmentControlManagers;

    #[ORM\OneToMany(mappedBy: 'editor', targetEntity: Equipment::class)]
    private Collection $equipmentEditors;

    #[ORM\OneToMany(mappedBy: 'borrower', targetEntity: EquipmentLoan::class, cascade: ['persist'], orphanRemoval: true)]
    private Collection $equipmentLoans;

    #[ORM\OneToMany(mappedBy: 'access', targetEntity: Equipment::class, cascade: ['persist'], orphanRemoval: true)]
    private Collection $equipments;

    #[ORM\OneToMany(mappedBy: 'access', targetEntity: AccessFictionalIntangible::class, cascade: ['persist'], orphanRemoval: true)]
    private Collection $accessFictionalIntangibles;

    #[ORM\OneToMany(mappedBy: 'access', targetEntity: Donor::class, cascade: ['persist'], orphanRemoval: true)]
    private Collection $donors;

    #[ORM\OneToMany(mappedBy: 'access', targetEntity: Medal::class, cascade: ['persist'], orphanRemoval: true)]
    private Collection $medals;

    #[ORM\OneToMany(mappedBy: 'access', targetEntity: OrganizationResponsability::class, cascade: ['persist'], orphanRemoval: true)]
    private Collection $organizationResponsabilities;

    #[ORM\OneToMany(mappedBy: 'accessOriginal', targetEntity: AccessWish::class, cascade: ['persist', 'remove'], fetch: 'EAGER', orphanRemoval: true)]
    private Collection $accessWishes;

    #[ORM\OneToMany(mappedBy: 'student', targetEntity: WorkByUser::class, cascade: ['persist'], orphanRemoval: true)]
    private Collection $workByUsers;

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

    #[Pure]
    public function __construct()
    {
        $this->personActivity = new ArrayCollection();
        $this->organizationFunction = new ArrayCollection();
        $this->organizationLicences = new ArrayCollection();
        $this->personalizedLists = new ArrayCollection();
        $this->guardians = new ArrayCollection();
        $this->children = new ArrayCollection();
        $this->billingPayers = new ArrayCollection();
        $this->billingReceivers = new ArrayCollection();
        $this->accessIntangibles = new ArrayCollection();
        $this->notifications = new ArrayCollection();
        $this->notificationUsers = new ArrayCollection();
        $this->companyPersonAccesses = new ArrayCollection();
        $this->companyPersonCompany = new ArrayCollection();
        $this->educationStudent = new ArrayCollection();
        $this->educationStudentByTeacher = new ArrayCollection();
        $this->educationTeachers = new ArrayCollection();
        $this->holidays = new ArrayCollection();
        $this->courses = new ArrayCollection();
        $this->practicalCourses = new ArrayCollection();
        $this->billingEducationalProjectPayers = new ArrayCollection();
        $this->bills = new ArrayCollection();
        $this->billLines = new ArrayCollection();
        $this->billCredits = new ArrayCollection();
        $this->silentPartners = new ArrayCollection();
        $this->operationalPartners = new ArrayCollection();
        $this->eventUsers = new ArrayCollection();
        $this->examenConvocations = new ArrayCollection();
        $this->equipmentRepairProviders = new ArrayCollection();
        $this->attendances = new ArrayCollection();
        $this->attendanceBookings = new ArrayCollection();
        $this->attendanceReplacements = new ArrayCollection();
        $this->roomRepairProviders = new ArrayCollection();
        $this->placeRepairProviders = new ArrayCollection();
        $this->juryMembers = new ArrayCollection();
        $this->organizationContacts = new ArrayCollection();
        $this->commissionMembers = new ArrayCollection();
        $this->equipmentSuppliers = new ArrayCollection();
        $this->equipmentControlManagers = new ArrayCollection();
        $this->equipmentEditors = new ArrayCollection();
        $this->equipmentLoans = new ArrayCollection();
        $this->equipments = new ArrayCollection();
        $this->accessFictionalIntangibles = new ArrayCollection();
        $this->donors = new ArrayCollection();
        $this->medals = new ArrayCollection();
        $this->organizationResponsabilities = new ArrayCollection();
        $this->accessWishes = new ArrayCollection();
        $this->workByUsers = new ArrayCollection();
        $this->tags = new ArrayCollection();
        $this->eventOrganizers = new ArrayCollection();
        $this->educationalProjectOrganizers = new ArrayCollection();
        $this->emails = new ArrayCollection();
        $this->mails = new ArrayCollection();
        $this->sms = new ArrayCollection();
    }

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

    public function getAdminAccess(): ?bool
    {
        return $this->adminAccess;
    }

    public function setAdminAccess(bool $adminAccess): self
    {
        $this->adminAccess = $adminAccess;
        return $this;
    }

    public function getSuperAdminAccess(): ?bool
    {
        return $this->superAdminAccess;
    }

    public function setSuperAdminAccess(bool $superAdminAccess): self
    {
        $this->superAdminAccess = $superAdminAccess;
        return $this;
    }

    public function getPerson(): ?Person
    {
        return $this->person;
    }

    public function setPerson(?Person $person): self
    {
        $this->person = $person;
        return $this;
    }

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

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

    public function getActivityYear(): ?int
    {
        return $this->activityYear;
    }

    public function setActivityYear(?int $activityYear): self
    {
        $this->activityYear = $activityYear;
        return $this;
    }

    /**
     * @return array<mixed>
     */
    public function getHistorical(): array
    {
        return array_key_exists('historical', $this->setting) && $this->setting['historical'] ? $this->setting['historical'] : ['present' => true];
    }


    /**
     * @param array<mixed> $historical
     * @return $this
     */
    #[Groups(['my_access:input'])]
    public function setHistorical(array $historical): self
    {
        // Une entrée dateStart mais pas de dateEnd, on retire dateEnd
        if (array_key_exists('dateStart', $historical) && !array_key_exists('dateEnd', $historical)) {
            unset($historical['dateStart']);
        }
        // Une entrée dateEnd mais pas de dateStart, on retire dateEnd
        else if (!array_key_exists('dateStart', $historical) && array_key_exists('dateEnd', $historical)) {
            unset($historical['dateEnd']);
        }

        // Les entrées dateStart et dateEnd existent mais ne sont pas toutes les deux renseignées, on retire les deux
        if (
            array_key_exists('dateStart', $historical) &&
            array_key_exists('dateEnd', $historical) &&
            (!$historical['dateStart'] || !$historical['dateEnd'])
        ) {
            unset($historical['dateStart']);
            unset($historical['dateEnd']);
        }

        // Aucun temps ni période n'est défini, on définit par défaut present à vrai
        if (!$historical['past'] && !$historical['present'] && !$historical['future'] && !array_key_exists('dateStart', $historical) ) {
            $historical['present'] = true;
        }

        $this->setting['historical'] = $historical;
        return $this;
    }

    /**
     * @param mixed[]|null $roles
     * @return $this
     */
    public function setRoles(?array $roles): self
    {
        $this->roles = $roles;
        return $this;
    }

    /**
     * @return mixed[]
     */
    public function getRoles(): array
    {
        $roles = $this->roles;
        return array_unique($roles ?? []);
    }

    public function getPersonActivity(): Collection
    {
        return $this->personActivity;
    }

    public function addPersonActivity(PersonActivity $personActivity): self
    {
        if (!$this->personActivity->contains($personActivity)) {
            $this->personActivity[] = $personActivity;
            $personActivity->setAccess($this);
        }
        return $this;
    }

    public function removePersonActivity(PersonActivity $personActivity): self
    {
        if ($this->personActivity->removeElement($personActivity)) {
            // set the owning side to null (unless already changed)
            if ($personActivity->getAccess() === $this) {
                $personActivity->setAccess(null);
            }
        }
        return $this;
    }

    public function getOrganizationFunction(): Collection
    {
        return $this->organizationFunction;
    }

    public function addOrganizationFunction(OrganizationFunction $organizationFunction): self
    {
        if (!$this->organizationFunction->contains($organizationFunction)) {
            $this->organizationFunction[] = $organizationFunction;
            $organizationFunction->setAccess($this);
        }
        return $this;
    }

    public function removeOrganizationFunction(OrganizationFunction $organizationFunction): self
    {
        if ($this->organizationFunction->removeElement($organizationFunction)) {
            // set the owning side to null (unless already changed)
            if ($organizationFunction->getAccess() === $this) {
                $organizationFunction->setAccess(null);
            }
        }
        return $this;
    }

    public function getOrganizationLicences(): Collection
    {
        return $this->organizationLicences;
    }

    public function addOrganizationLicence(OrganizationLicence $organizationLicence): self
    {
        if (!$this->organizationLicences->contains($organizationLicence)) {
            $this->organizationLicences[] = $organizationLicence;
            $organizationLicence->setLicensee($this);
        }
        return $this;
    }

    public function removeOrganizationLicence(OrganizationLicence $organizationLicence): self
    {
        if ($this->organizationLicences->removeElement($organizationLicence)) {
            // set the owning side to null (unless already changed)
            if ($organizationLicence->getLicensee() === $this) {
                $organizationLicence->setLicensee(null);
            }
        }
        return $this;
    }

    public function getPersonalizedLists(): Collection
    {
        return $this->personalizedLists;
    }

    public function addPersonalizedList(PersonalizedList $personalizedList): self
    {
        if (!$this->personalizedLists->contains($personalizedList)) {
            $this->personalizedLists[] = $personalizedList;
            $personalizedList->setAccess($this);
        }
        return $this;
    }

    public function removePersonalizedList(PersonalizedList $personalizedList): self
    {
        if ($this->personalizedLists->removeElement($personalizedList)) {
            // set the owning side to null (unless already changed)
            if ($personalizedList->getAccess() === $this) {
                $personalizedList->setAccess(null);
            }
        }
        return $this;
    }

    public function getChildren(): Collection
    {
        return $this->children;
    }

    public function addChild(Access $access): self
    {
        if (!$this->children->contains($access)) {
            $this->children[] = $access;
            $access->addGuardian($this);
        }
        return $this;
    }

    public function removeChild(Access $access): self
    {
        if ($this->children->removeElement($access)) {
            $access->removeGuardian($this);
        }
        return $this;
    }

    public function getGuardians(): Collection
    {
        return $this->guardians;
    }

    public function addGuardian(Access $access): self
    {
        if (!$this->guardians->contains($access)) {
            $this->guardians[] = $access;
            $access->addChild($this);
        }
        return $this;
    }

    public function removeGuardian(Access $access): self
    {
        if ($this->guardians->removeElement($access)) {
            $access->removeChild($this);
        }
        return $this;
    }

    public function getBillingPayers(): Collection
    {
        return $this->billingPayers;
    }

    public function addBillingPayer(AccessPayer $billingPayer): self
    {
        if (!$this->billingPayers->contains($billingPayer)) {
            $this->billingPayers[] = $billingPayer;
            $billingPayer->setAccessPayer($this);
        }
        return $this;
    }

    public function removeBillingPayer(AccessPayer $billingPayer): self
    {
        if ($this->billingPayers->removeElement($billingPayer)) {
            // set the owning side to null (unless already changed)
            if ($billingPayer->getAccessPayer() === $this) {
                $billingPayer->setAccessPayer(null);
            }
        }
        return $this;
    }

    public function getBillingReceivers(): Collection
    {
        return $this->billingReceivers;
    }

    public function addBillingReceiver(AccessPayer $billingReceiver): self
    {
        if (!$this->billingReceivers->contains($billingReceiver)) {
            $this->billingReceivers[] = $billingReceiver;
            $billingReceiver->setAccessReceiver($this);
        }
        return $this;
    }

    public function removeBillingReceiver(AccessPayer $billingPayer): self
    {
        if ($this->billingReceivers->removeElement($billingPayer)) {
            // set the owning side to null (unless already changed)
            if ($billingPayer->getAccessReceiver() === $this) {
                $billingPayer->setAccessReceiver(null);
            }
        }
        return $this;
    }

    public function getAccessIntangibles(): Collection
    {
        return $this->accessIntangibles;
    }

    public function addAccessIntangible(AccessIntangible $accessIntangibles): self
    {
        if (!$this->accessIntangibles->contains($accessIntangibles)) {
            $this->accessIntangibles[] = $accessIntangibles;
            $accessIntangibles->setAccess($this);
        }
        return $this;
    }

    public function removeAccessIntangible(AccessIntangible $accessIntangibles): self
    {
        if ($this->accessIntangibles->removeElement($accessIntangibles)) {
            // set the owning side to null (unless already changed)
            if ($accessIntangibles->getAccess() === $this) {
                $accessIntangibles->setAccess(null);
            }
        }
        return $this;
    }

    public function getNotifications(): Collection
    {
        return $this->notifications;
    }

    public function addNotification(Notification $notification): self
    {
        if (!$this->notifications->contains($notification)) {
            $this->notifications[] = $notification;
            $notification->setRecipientAccess($this);
        }
        return $this;
    }

    public function removeNotification(Notification $notification): self
    {
        if ($this->notifications->removeElement($notification)) {
            // set the owning side to null (unless already changed)
            if ($notification->getRecipientAccess() === $this) {
                $notification->setRecipientAccess(null);
            }
        }
        return $this;
    }

    public function getNotificationUsers(): Collection
    {
        return $this->notificationUsers;
    }

    public function addNotificationUser(NotificationUser $notificationUser): self
    {
        if (!$this->notificationUsers->contains($notificationUser)) {
            $this->notificationUsers[] = $notificationUser;
            $notificationUser->setAccess($this);
        }
        return $this;
    }

    public function removeNotificationUser(NotificationUser $notificationUser): self
    {
        if ($this->notificationUsers->removeElement($notificationUser)) {
            // set the owning side to null (unless already changed)
            if ($notificationUser->getAccess() === $this) {
                $notificationUser->setAccess(null);
            }
        }
        return $this;
    }

    public function getPublicationDirector(): ?Parameters
    {
        return $this->publicationDirector;
    }

    public function setPublicationDirector(?Parameters $parameters): self
    {
        $this->publicationDirector = $parameters;
        return $this;
    }

    public function getEducationNotationConfig(): ?EducationNotationConfig
    {
        return $this->educationNotationConfig;
    }

    public function setEducationNotationConfig(?EducationNotationConfig $educationNotationConfig): self
    {
        $this->educationNotationConfig = $educationNotationConfig;
        return $this;
    }

    #[Pure]
    public function getUserIdentifier(): string
    {
        return $this->person->getUserIdentifier();
    }

    public function getPassword(): ?string
    {
        return null;
    }

    public function getSalt(): ?string
    {
        return null;
    }

    public function getUsername(): ?string
    {
        return null;
    }

    public function eraseCredentials(): void
    {
        // TODO: Implement eraseCredentials() method.
    }

    /**
     * @return mixed[]|null
     */
    public function getSetting(): ?array
    {
        return $this->setting;
    }

    /**
     * @param mixed[]|null $setting
     * @return $this
     */
    public function setSetting(?array $setting): self
    {
        $this->setting = $setting;
        return $this;
    }

    /**
     * @return Collection<int, CompanyPerson>
     */
    public function getCompanyPersonAccesses(): Collection
    {
        return $this->companyPersonAccesses;
    }

    public function addCompanyPersonAccess(CompanyPerson $companyPersonAccess): self
    {
        if (!$this->companyPersonAccesses->contains($companyPersonAccess)) {
            $this->companyPersonAccesses[] = $companyPersonAccess;
            $companyPersonAccess->setCompany($this);
        }
        return $this;
    }

    public function removeCompanyPersonAccess(CompanyPerson $companyPersonAccess): self
    {
        if ($this->companyPersonAccesses->removeElement($companyPersonAccess)) {
            // set the owning side to null (unless already changed)
            if ($companyPersonAccess->getCompany() === $this) {
                $companyPersonAccess->setCompany(null);
            }
        }
        return $this;
    }

    /**
     * @return Collection<int, CompanyPerson>
     */
    public function getCompanyPersonCompany(): Collection
    {
        return $this->companyPersonCompany;
    }

    public function addCompanyPersonCompany(CompanyPerson $companyPersonCompany): self
    {
        if (!$this->companyPersonCompany->contains($companyPersonCompany)) {
            $this->companyPersonCompany[] = $companyPersonCompany;
            $companyPersonCompany->setAccess($this);
        }
        return $this;
    }

    public function removeCompanyPersonCompany(CompanyPerson $companyPersonCompany): self
    {
        if ($this->companyPersonCompany->removeElement($companyPersonCompany)) {
            // set the owning side to null (unless already changed)
            if ($companyPersonCompany->getAccess() === $this) {
                $companyPersonCompany->setAccess(null);
            }
        }
        return $this;
    }

    /**
     * @return Collection<int, EducationStudent>
     */
    public function getEducationStudent(): Collection
    {
        return $this->educationStudent;
    }

    public function addEducationStudent(EducationStudent $educationStudent): self
    {
        if (!$this->educationStudent->contains($educationStudent)) {
            $this->educationStudent[] = $educationStudent;
            $educationStudent->setAccess($this);
        }
        return $this;
    }

    public function removeEducationStudent(EducationStudent $educationStudent): self
    {
        if ($this->educationStudent->removeElement($educationStudent)) {
            // set the owning side to null (unless already changed)
            if ($educationStudent->getAccess() === $this) {
                $educationStudent->setAccess(null);
            }
        }
        return $this;
    }

    /**
     * @return Collection<int, EducationStudent>
     */
    public function getEducationStudentByTeacher(): Collection
    {
        return $this->educationStudentByTeacher;
    }

    public function addEducationStudentByTeacher(EducationStudent $educationStudentByTeacher): self
    {
        if (!$this->educationStudentByTeacher->contains($educationStudentByTeacher)) {
            $this->educationStudentByTeacher[] = $educationStudentByTeacher;
            $educationStudentByTeacher->addTeacher($this);
        }
        return $this;
    }

    public function removeEducationStudentByTeacher(EducationStudent $educationStudentByTeacher): self
    {
        if ($this->educationStudentByTeacher->removeElement($educationStudentByTeacher)) {
            $educationStudentByTeacher->removeTeacher($this);
        }
        return $this;
    }

    /**
     * @return Collection<int, EducationTeacher>
     */
    public function getEducationTeachers(): Collection
    {
        return $this->educationTeachers;
    }

    public function addEducationTeacher(EducationTeacher $educationTeacher): self
    {
        if (!$this->educationTeachers->contains($educationTeacher)) {
            $this->educationTeachers[] = $educationTeacher;
            $educationTeacher->setTeacher($this);
        }
        return $this;
    }

    public function removeEducationTeacher(EducationTeacher $educationTeacher): self
    {
        if ($this->educationTeachers->removeElement($educationTeacher)) {
            // set the owning side to null (unless already changed)
            if ($educationTeacher->getTeacher() === $this) {
                $educationTeacher->setTeacher(null);
            }
        }
        return $this;
    }

    /**
     * @return Collection<int, PersonHoliday>
     */
    public function getHolidays(): Collection
    {
        return $this->holidays;
    }

    public function addHoliday(PersonHoliday $holiday): self
    {
        if (!$this->holidays->contains($holiday)) {
            $this->holidays[] = $holiday;
            $holiday->setAccess($this);
        }
        return $this;
    }

    public function removeHoliday(PersonHoliday $holiday): self
    {
        if ($this->holidays->removeElement($holiday)) {
            // set the owning side to null (unless already changed)
            if ($holiday->getAccess() === $this) {
                $holiday->setAccess(null);
            }
        }
        return $this;
    }

    /**
     * @return Collection<int, Course>
     */
    public function getCourses(): Collection
    {
        return $this->courses;
    }

    public function addCourse(Course $course): self
    {
        if (!$this->courses->contains($course)) {
            $this->courses[] = $course;
            $course->addStudent($this);
        }
        return $this;
    }

    public function removeCourse(Course $course): self
    {
        if ($this->courses->removeElement($course)) {
            $course->removeStudent($this);
        }
        return $this;
    }

    /**
     * @return Collection<int, Course>
     */
    public function getPracticalCourses(): Collection
    {
        return $this->practicalCourses;
    }

    public function addPracticalCourse(Course $practicalCourse): self
    {
        if (!$this->practicalCourses->contains($practicalCourse)) {
            $this->practicalCourses[] = $practicalCourse;
            $practicalCourse->addOrganizer($this);
        }
        return $this;
    }

    public function removePracticalCourse(Course $practicalCourse): self
    {
        if ($this->practicalCourses->removeElement($practicalCourse)) {
            $practicalCourse->removeOrganizer($this);
        }
        return $this;
    }

    public function getAccessFamily(): ?AccessFamily
    {
        return $this->accessFamily;
    }

    public function setAccessFamily(?AccessFamily $accessFamily): self
    {
        $this->accessFamily = $accessFamily;
        return $this;
    }

    /**
     * @return Collection<int, EducationalProjectPayer>
     */
    public function getBillingEducationalProjectPayers(): Collection
    {
        return $this->billingEducationalProjectPayers;
    }

    public function addBillingEducationalProjectPayer(EducationalProjectPayer $billingEducationalProjectPayer): self
    {
        if (!$this->billingEducationalProjectPayers->contains($billingEducationalProjectPayer)) {
            $this->billingEducationalProjectPayers[] = $billingEducationalProjectPayer;
            $billingEducationalProjectPayer->setEducationalProjectPayer($this);
        }
        return $this;
    }

    public function removeBillingEducationalProjectPayer(EducationalProjectPayer $billingEducationalProjectPayer): self
    {
        if ($this->billingEducationalProjectPayers->removeElement($billingEducationalProjectPayer)) {
            // set the owning side to null (unless already changed)
            if ($billingEducationalProjectPayer->getEducationalProjectPayer() === $this) {
                $billingEducationalProjectPayer->setEducationalProjectPayer(null);
            }
        }
        return $this;
    }

    /**
     * @return Collection<int, Bill>
     */
    public function getBills(): Collection
    {
        return $this->bills;
    }

    public function addBill(Bill $bill): self
    {
        if (!$this->bills->contains($bill)) {
            $this->bills[] = $bill;
            $bill->setAccess($this);
        }
        return $this;
    }

    public function removeBill(Bill $bill): self
    {
        if ($this->bills->removeElement($bill)) {
            // set the owning side to null (unless already changed)
            if ($bill->getAccess() === $this) {
                $bill->setAccess(null);
            }
        }
        return $this;
    }

    /**
     * @return Collection<int, BillLine>
     */
    public function getBillLines(): Collection
    {
        return $this->billLines;
    }

    public function addBillLine(BillLine $billLine): self
    {
        if (!$this->billLines->contains($billLine)) {
            $this->billLines[] = $billLine;
            $billLine->setAccess($this);
        }
        return $this;
    }

    public function removeBillLine(BillLine $billLine): self
    {
        if ($this->billLines->removeElement($billLine)) {
            // set the owning side to null (unless already changed)
            if ($billLine->getAccess() === $this) {
                $billLine->setAccess(null);
            }
        }
        return $this;
    }

    /**
     * @return Collection<int, BillCredit>
     */
    public function getBillCredits(): Collection
    {
        return $this->billCredits;
    }

    public function addBillCredit(BillCredit $billCredit): self
    {
        if (!$this->billCredits->contains($billCredit)) {
            $this->billCredits[] = $billCredit;
            $billCredit->setAccess($this);
        }
        return $this;
    }

    public function removeBillCredit(BillCredit $billCredit): self
    {
        if ($this->billCredits->removeElement($billCredit)) {
            // set the owning side to null (unless already changed)
            if ($billCredit->getAccess() === $this) {
                $billCredit->setAccess(null);
            }
        }
        return $this;
    }

    /**
     * @return Collection<int, EducationalProject>
     */
    public function getSilentPartners(): Collection
    {
        return $this->silentPartners;
    }

    public function addSilentPartner(EducationalProject $silentPartner): self
    {
        if (!$this->silentPartners->contains($silentPartner)) {
            $this->silentPartners[] = $silentPartner;
            $silentPartner->setSilentPartner($this);
        }
        return $this;
    }

    public function removeSilentPartner(EducationalProject $silentPartner): self
    {
        if ($this->silentPartners->removeElement($silentPartner)) {
            // set the owning side to null (unless already changed)
            if ($silentPartner->getSilentPartner() === $this) {
                $silentPartner->setSilentPartner(null);
            }
        }
        return $this;
    }

    /**
     * @return Collection<int, EducationalProject>
     */
    public function getOperationalPartners(): Collection
    {
        return $this->operationalPartners;
    }

    public function addOperationalPartner(EducationalProject $operationalPartner): self
    {
        if (!$this->operationalPartners->contains($operationalPartner)) {
            $this->operationalPartners[] = $operationalPartner;
            $operationalPartner->setOperationalPartner($this);
        }
        return $this;
    }

    public function removeOperationalPartner(EducationalProject $operationalPartner): self
    {
        if ($this->operationalPartners->removeElement($operationalPartner)) {
            // set the owning side to null (unless already changed)
            if ($operationalPartner->getOperationalPartner() === $this) {
                $operationalPartner->setOperationalPartner(null);
            }
        }
        return $this;
    }

    /**
     * @return Collection<int, EventUser>
     */
    public function getEventUsers(): Collection
    {
        return $this->eventUsers;
    }

    public function addEventUser(EventUser $eventUser): self
    {
        if (!$this->eventUsers->contains($eventUser)) {
            $this->eventUsers[] = $eventUser;
            $eventUser->setGuest($this);
        }
        return $this;
    }

    public function removeEventUser(EventUser $eventUser): self
    {
        if ($this->eventUsers->removeElement($eventUser)) {
            // set the owning side to null (unless already changed)
            if ($eventUser->getGuest() === $this) {
                $eventUser->setGuest(null);
            }
        }
        return $this;
    }

    /**
     * @return Collection<int, ExamenConvocation>
     */
    public function getExamenConvocations(): Collection
    {
        return $this->examenConvocations;
    }

    public function addExamenConvocation(ExamenConvocation $examenConvocation): self
    {
        if (!$this->examenConvocations->contains($examenConvocation)) {
            $this->examenConvocations[] = $examenConvocation;
            $examenConvocation->setStudent($this);
        }
        return $this;
    }

    public function removeExamenConvocation(ExamenConvocation $examenConvocation): self
    {
        if ($this->examenConvocations->removeElement($examenConvocation)) {
            // set the owning side to null (unless already changed)
            if ($examenConvocation->getStudent() === $this) {
                $examenConvocation->setStudent(null);
            }
        }
        return $this;
    }

    /**
     * @return Collection<int, EquipmentRepair>
     */
    public function getEquipmentRepairProviders(): Collection
    {
        return $this->equipmentRepairProviders;
    }

    public function addEquipmentRepairProvider(EquipmentRepair $equipmentRepairProvider): self
    {
        if (!$this->equipmentRepairProviders->contains($equipmentRepairProvider)) {
            $this->equipmentRepairProviders[] = $equipmentRepairProvider;
            $equipmentRepairProvider->setProvider($this);
        }
        return $this;
    }

    public function removeEquipmentRepairProvider(EquipmentRepair $equipmentRepairProvider): self
    {
        if ($this->equipmentRepairProviders->removeElement($equipmentRepairProvider)) {
            // set the owning side to null (unless already changed)
            if ($equipmentRepairProvider->getProvider() === $this) {
                $equipmentRepairProvider->setProvider(null);
            }
        }
        return $this;
    }

    /**
     * @return Collection<int, Attendance>
     */
    public function getAttendances(): Collection
    {
        return $this->attendances;
    }

    public function addAttendance(Attendance $attendance): self
    {
        if (!$this->attendances->contains($attendance)) {
            $this->attendances[] = $attendance;
            $attendance->setAccess($this);
        }
        return $this;
    }

    public function removeAttendance(Attendance $attendance): self
    {
        if ($this->attendances->removeElement($attendance)) {
            // set the owning side to null (unless already changed)
            if ($attendance->getAccess() === $this) {
                $attendance->setAccess(null);
            }
        }
        return $this;
    }

    /**
     * @return Collection<int, AttendanceBooking>
     */
    public function getAttendanceBookings(): Collection
    {
        return $this->attendanceBookings;
    }

    public function addAttendanceBooking(AttendanceBooking $attendanceBooking): self
    {
        if (!$this->attendanceBookings->contains($attendanceBooking)) {
            $this->attendanceBookings[] = $attendanceBooking;
            $attendanceBooking->setAccess($this);
        }
        return $this;
    }

    public function removeAttendanceBooking(AttendanceBooking $attendanceBooking): self
    {
        if ($this->attendanceBookings->removeElement($attendanceBooking)) {
            // set the owning side to null (unless already changed)
            if ($attendanceBooking->getAccess() === $this) {
                $attendanceBooking->setAccess(null);
            }
        }
        return $this;
    }

    /**
     * @return Collection<int, Attendance>
     */
    public function getAttendanceReplacements(): Collection
    {
        return $this->attendanceReplacements;
    }

    public function addAttendanceReplacement(Attendance $attendanceReplacement): self
    {
        if (!$this->attendanceReplacements->contains($attendanceReplacement)) {
            $this->attendanceReplacements[] = $attendanceReplacement;
            $attendanceReplacement->setReplacement($this);
        }
        return $this;
    }

    public function removeAttendanceReplacement(Attendance $attendanceReplacement): self
    {
        if ($this->attendanceReplacements->removeElement($attendanceReplacement)) {
            // set the owning side to null (unless already changed)
            if ($attendanceReplacement->getReplacement() === $this) {
                $attendanceReplacement->setReplacement(null);
            }
        }
        return $this;
    }

    /**
     * @return Collection<int, RoomRepair>
     */
    public function getRoomRepairProviders(): Collection
    {
        return $this->roomRepairProviders;
    }

    public function addRoomRepairProvider(RoomRepair $roomRepairProvider): self
    {
        if (!$this->roomRepairProviders->contains($roomRepairProvider)) {
            $this->roomRepairProviders[] = $roomRepairProvider;
            $roomRepairProvider->setProvider($this);
        }
        return $this;
    }

    public function removeRoomRepairProvider(RoomRepair $roomRepairProvider): self
    {
        if ($this->roomRepairProviders->removeElement($roomRepairProvider)) {
            // set the owning side to null (unless already changed)
            if ($roomRepairProvider->getProvider() === $this) {
                $roomRepairProvider->setProvider(null);
            }
        }
        return $this;
    }

    /**
     * @return Collection<int, PlaceRepair>
     */
    public function getPlaceRepairProviders(): Collection
    {
        return $this->placeRepairProviders;
    }

    public function addPlaceRepairProvider(PlaceRepair $placeRepairProvider): self
    {
        if (!$this->placeRepairProviders->contains($placeRepairProvider)) {
            $this->placeRepairProviders[] = $placeRepairProvider;
            $placeRepairProvider->setProvider($this);
        }
        return $this;
    }

    public function removePlaceRepairProvider(PlaceRepair $placeRepairProvider): self
    {
        if ($this->placeRepairProviders->removeElement($placeRepairProvider)) {
            // set the owning side to null (unless already changed)
            if ($placeRepairProvider->getProvider() === $this) {
                $placeRepairProvider->setProvider(null);
            }
        }
        return $this;
    }

    /**
     * @return Collection<int, Jury>
     */
    public function getJuryMembers(): Collection
    {
        return $this->juryMembers;
    }

    public function addJuryMember(Jury $juryMember): self
    {
        if (!$this->juryMembers->contains($juryMember)) {
            $this->juryMembers[] = $juryMember;
            $juryMember->addMember($this);
        }
        return $this;
    }

    public function removeJuryMember(Jury $juryMember): self
    {
        if ($this->juryMembers->removeElement($juryMember)) {
            $juryMember->removeMember($this);
        }
        return $this;
    }

    /**
     * @return Collection<int, Organization>
     */
    public function getOrganizationContacts(): Collection
    {
        return $this->organizationContacts;
    }

    public function addOrganizationContact(Organization $organizationContact): self
    {
        if (!$this->organizationContacts->contains($organizationContact)) {
            $this->organizationContacts[] = $organizationContact;
            $organizationContact->setContactPerson($this);
        }
        return $this;
    }

    public function removeOrganizationContact(Organization $organizationContact): self
    {
        if ($this->organizationContacts->removeElement($organizationContact)) {
            // set the owning side to null (unless already changed)
            if ($organizationContact->getContactPerson() === $this) {
                $organizationContact->setContactPerson(null);
            }
        }
        return $this;
    }

    /**
     * @return Collection<int, CommissionMember>
     */
    public function getCommissionMembers(): Collection
    {
        return $this->commissionMembers;
    }

    public function addCommissionMember(CommissionMember $commissionMember): self
    {
        if (!$this->commissionMembers->contains($commissionMember)) {
            $this->commissionMembers[] = $commissionMember;
            $commissionMember->setMember($this);
        }
        return $this;
    }

    public function removeCommissionMember(CommissionMember $commissionMember): self
    {
        if ($this->commissionMembers->removeElement($commissionMember)) {
            // set the owning side to null (unless already changed)
            if ($commissionMember->getMember() === $this) {
                $commissionMember->setMember(null);
            }
        }
        return $this;
    }

    /**
     * @return Collection<int, Equipment>
     */
    public function getEquipmentSuppliers(): Collection
    {
        return $this->equipmentSuppliers;
    }

    public function addEquipmentSupplier(Equipment $equipmentSupplier): self
    {
        if (!$this->equipmentSuppliers->contains($equipmentSupplier)) {
            $this->equipmentSuppliers[] = $equipmentSupplier;
            $equipmentSupplier->setSupplier($this);
        }
        return $this;
    }

    public function removeEquipmentSupplier(Equipment $equipmentSupplier): self
    {
        if ($this->equipmentSuppliers->removeElement($equipmentSupplier)) {
            // set the owning side to null (unless already changed)
            if ($equipmentSupplier->getSupplier() === $this) {
                $equipmentSupplier->setSupplier(null);
            }
        }
        return $this;
    }

    /**
     * @return Collection<int, Equipment>
     */
    public function getEquipmentControlManagers(): Collection
    {
        return $this->equipmentControlManagers;
    }

    public function addEquipmentControlManager(Equipment $equipmentControlManager): self
    {
        if (!$this->equipmentControlManagers->contains($equipmentControlManager)) {
            $this->equipmentControlManagers[] = $equipmentControlManager;
            $equipmentControlManager->setControlManager($this);
        }
        return $this;
    }

    public function removeEquipmentControlManager(Equipment $equipmentControlManager): self
    {
        if ($this->equipmentControlManagers->removeElement($equipmentControlManager)) {
            // set the owning side to null (unless already changed)
            if ($equipmentControlManager->getControlManager() === $this) {
                $equipmentControlManager->setControlManager(null);
            }
        }
        return $this;
    }

    /**
     * @return Collection<int, Equipment>
     */
    public function getEquipmentEditors(): Collection
    {
        return $this->equipmentEditors;
    }

    public function addEquipmentEditor(Equipment $equipmentEditor): self
    {
        if (!$this->equipmentEditors->contains($equipmentEditor)) {
            $this->equipmentEditors[] = $equipmentEditor;
            $equipmentEditor->setEditor($this);
        }
        return $this;
    }

    public function removeEquipmentEditor(Equipment $equipmentEditor): self
    {
        if ($this->equipmentEditors->removeElement($equipmentEditor)) {
            // set the owning side to null (unless already changed)
            if ($equipmentEditor->getEditor() === $this) {
                $equipmentEditor->setEditor(null);
            }
        }
        return $this;
    }

    /**
     * @return Collection<int, EquipmentLoan>
     */
    public function getEquipmentLoans(): Collection
    {
        return $this->equipmentLoans;
    }

    public function addEquipmentLoan(EquipmentLoan $equipmentLoan): self
    {
        if (!$this->equipmentLoans->contains($equipmentLoan)) {
            $this->equipmentLoans[] = $equipmentLoan;
            $equipmentLoan->setBorrower($this);
        }
        return $this;
    }

    public function removeEquipmentLoan(EquipmentLoan $equipmentLoan): self
    {
        if ($this->equipmentLoans->removeElement($equipmentLoan)) {
            // set the owning side to null (unless already changed)
            if ($equipmentLoan->getBorrower() === $this) {
                $equipmentLoan->setBorrower(null);
            }
        }
        return $this;
    }

    /**
     * @return Collection<int, Equipment>
     */
    public function getEquipments(): Collection
    {
        return $this->equipments;
    }

    public function addEquipment(Equipment $equipment): self
    {
        if (!$this->equipments->contains($equipment)) {
            $this->equipments[] = $equipment;
            $equipment->setAccess($this);
        }
        return $this;
    }

    public function removeEquipment(Equipment $equipment): self
    {
        if ($this->equipments->removeElement($equipment)) {
            // set the owning side to null (unless already changed)
            if ($equipment->getAccess() === $this) {
                $equipment->setAccess(null);
            }
        }
        return $this;
    }

    /**
     * @return Collection<int, AccessFictionalIntangible>
     */
    public function getAccessFictionalIntangibles(): Collection
    {
        return $this->accessFictionalIntangibles;
    }

    public function addAccessFictionalIntangible(AccessFictionalIntangible $accessFictionalIntangible): self
    {
        if (!$this->accessFictionalIntangibles->contains($accessFictionalIntangible)) {
            $this->accessFictionalIntangibles[] = $accessFictionalIntangible;
            $accessFictionalIntangible->setAccess($this);
        }
        return $this;
    }

    public function removeAccessFictionalIntangible(AccessFictionalIntangible $accessFictionalIntangible): self
    {
        if ($this->accessFictionalIntangibles->removeElement($accessFictionalIntangible)) {
            // set the owning side to null (unless already changed)
            if ($accessFictionalIntangible->getAccess() === $this) {
                $accessFictionalIntangible->setAccess(null);
            }
        }
        return $this;
    }

    /**
     * @return Collection<int, Donor>
     */
    public function getDonors(): Collection
    {
        return $this->donors;
    }

    public function addDonor(Donor $donor): self
    {
        if (!$this->donors->contains($donor)) {
            $this->donors[] = $donor;
            $donor->setAccess($this);
        }
        return $this;
    }

    public function removeDonor(Donor $donor): self
    {
        if ($this->donors->removeElement($donor)) {
            // set the owning side to null (unless already changed)
            if ($donor->getAccess() === $this) {
                $donor->setAccess(null);
            }
        }
        return $this;
    }

    /**
     * @return Collection<int, Medal>
     */
    public function getMedals(): Collection
    {
        return $this->medals;
    }

    public function addMedal(Medal $medal): self
    {
        if (!$this->medals->contains($medal)) {
            $this->medals[] = $medal;
            $medal->setAccess($this);
        }
        return $this;
    }

    public function removeMedal(Medal $medal): self
    {
        if ($this->medals->removeElement($medal)) {
            // set the owning side to null (unless already changed)
            if ($medal->getAccess() === $this) {
                $medal->setAccess(null);
            }
        }
        return $this;
    }

    /**
     * @return Collection<int, OrganizationResponsability>
     */
    public function getOrganizationResponsabilities(): Collection
    {
        return $this->organizationResponsabilities;
    }

    public function addOrganizationResponsability(OrganizationResponsability $organizationResponsability): self
    {
        if (!$this->organizationResponsabilities->contains($organizationResponsability)) {
            $this->organizationResponsabilities[] = $organizationResponsability;
            $organizationResponsability->setAccess($this);
        }
        return $this;
    }

    public function removeOrganizationResponsability(OrganizationResponsability $organizationResponsability): self
    {
        if ($this->organizationResponsabilities->removeElement($organizationResponsability)) {
            // set the owning side to null (unless already changed)
            if ($organizationResponsability->getAccess() === $this) {
                $organizationResponsability->setAccess(null);
            }
        }
        return $this;
    }

    /**
     * @return Collection<int, AccessWish>
     */
    public function getAccessWishes(): Collection
    {
        return $this->accessWishes;
    }

    public function addAccessWish(AccessWish $accessWish): self
    {
        if (!$this->accessWishes->contains($accessWish)) {
            $this->accessWishes[] = $accessWish;
            $accessWish->setAccessOriginal($this);
        }
        return $this;
    }

    public function removeAccessWish(AccessWish $accessWish): self
    {
        if ($this->accessWishes->removeElement($accessWish)) {
            // set the owning side to null (unless already changed)
            if ($accessWish->getAccessOriginal() === $this) {
                $accessWish->setAccessOriginal(null);
            }
        }
        return $this;
    }

    /**
     * @return Collection<int, WorkByUser>
     */
    public function getWorkByUsers(): Collection
    {
        return $this->workByUsers;
    }

    public function addWorkByUser(WorkByUser $workByUser): self
    {
        if (!$this->workByUsers->contains($workByUser)) {
            $this->workByUsers[] = $workByUser;
            $workByUser->setStudent($this);
        }
        return $this;
    }

    public function removeWorkByUser(WorkByUser $workByUser): self
    {
        if ($this->workByUsers->removeElement($workByUser)) {
            // set the owning side to null (unless already changed)
            if ($workByUser->getStudent() === $this) {
                $workByUser->setStudent(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;
    }

    /**
     * @return Collection<int, Event>
     */
    public function getEventOrganizers(): Collection
    {
        return $this->eventOrganizers;
    }

    public function addEventOrganizer(Event $eventOrganizer): self
    {
        if (!$this->eventOrganizers->contains($eventOrganizer)) {
            $this->eventOrganizers[] = $eventOrganizer;
            $eventOrganizer->addOrganizer($this);
        }
        return $this;
    }

    public function removeEventOrganizer(Event $eventOrganizer): self
    {
        if ($this->eventOrganizers->removeElement($eventOrganizer)) {
            $eventOrganizer->removeOrganizer($this);
        }
        return $this;
    }

    /**
     * @return Collection<int, EducationalProject>
     */
    public function getEducationalProjectOrganizers(): Collection
    {
        return $this->educationalProjectOrganizers;
    }

    public function addEducationalProjectOrganizer(EducationalProject $educationalProjectOrganizer): self
    {
        if (!$this->educationalProjectOrganizers->contains($educationalProjectOrganizer)) {
            $this->educationalProjectOrganizers[] = $educationalProjectOrganizer;
            $educationalProjectOrganizer->addOrganizer($this);
        }
        return $this;
    }

    public function removeEducationalProjectOrganizer(EducationalProject $educationalProjectOrganizer): self
    {
        if ($this->educationalProjectOrganizers->removeElement($educationalProjectOrganizer)) {
            $educationalProjectOrganizer->removeOrganizer($this);
        }
        return $this;
    }

    /**
     * @return Collection<int, Email>
     */
    public function getEmails(): Collection
    {
        return $this->emails;
    }

    public function addEmail(Email $email): self
    {
        if (!$this->emails->contains($email)) {
            $this->emails[] = $email;
            $email->setAuthor($this);
        }
        return $this;
    }

    public function removeEmail(Email $email): self
    {
        if ($this->emails->removeElement($email)) {
            // set the owning side to null (unless already changed)
            if ($email->getAuthor() === $this) {
                $email->setAuthor(null);
            }
        }
        return $this;
    }

    /**
     * @return Collection<int, Mail>
     */
    public function getMails(): Collection
    {
        return $this->mails;
    }

    public function addMail(Mail $mail): self
    {
        if (!$this->mails->contains($mail)) {
            $this->mails[] = $mail;
            $mail->setAuthor($this);
        }
        return $this;
    }

    public function removeMail(Mail $mail): self
    {
        if ($this->mails->removeElement($mail)) {
            // set the owning side to null (unless already changed)
            if ($mail->getAuthor() === $this) {
                $mail->setAuthor(null);
            }
        }
        return $this;
    }

    /**
     * @return Collection<int, Sms>
     */
    public function getSms(): Collection
    {
        return $this->sms;
    }

    public function addSms(Sms $sms): self
    {
        if (!$this->sms->contains($sms)) {
            $this->sms[] = $sms;
            $sms->setAuthor($this);
        }
        return $this;
    }

    public function removeSms(Sms $sms): self
    {
        if ($this->sms->removeElement($sms)) {
            // set the owning side to null (unless already changed)
            if ($sms->getAuthor() === $this) {
                $sms->setAuthor(null);
            }
        }
        return $this;
    }

    public function getAccessBilling(): ?AccessBilling
    {
        return $this->accessBilling;
    }

    public function setAccessBilling(?AccessBilling $accessBilling): self
    {
        // unset the owning side of the relation if necessary
        if ($accessBilling === null && $this->accessBilling !== null) {
            $this->accessBilling->setAccess(null);
        }
        // set the owning side of the relation if necessary
        if ($accessBilling !== null && $accessBilling->getAccess() !== $this) {
            $accessBilling->setAccess($this);
        }
        $this->accessBilling = $accessBilling;
        return $this;
    }
}
