<?php

namespace App\Entity;

use App\Repository\TablesRepository;
use Doctrine\Common\Collections\ArrayCollection;
use Doctrine\Common\Collections\Collection;
use Doctrine\ORM\Mapping as ORM;

#[ORM\Entity(repositoryClass: TablesRepository::class)]
class Tables
{
    #[ORM\Id]
    #[ORM\GeneratedValue]
    #[ORM\Column]
    private ?int $id = null;

    /**
     * @var Collection<int, Clients>
     */
    #[ORM\ManyToMany(targetEntity: Clients::class, inversedBy: 'tables')]
    private Collection $Clients;

    /**
     * @var Collection<int, Reservations>
     */
    #[ORM\OneToMany(targetEntity: Reservations::class, mappedBy: 'tables')]
    private Collection $reservations;

    /**
     * @var Collection<int, StatutTables>
     */
    #[ORM\OneToMany(targetEntity: StatutTables::class, mappedBy: 'tables')]
    private Collection $statutTables;

    /**
     * @var Collection<int, Utilisateurs>
     */
    #[ORM\ManyToMany(targetEntity: Utilisateurs::class, mappedBy: 'tables')]
    private Collection $utilisateurs;

    public function __construct()
    {
        $this->Clients = new ArrayCollection();
        $this->reservations = new ArrayCollection();
        $this->statutTables = new ArrayCollection();
        $this->utilisateurs = new ArrayCollection();
    }

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

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

    public function addClient(Clients $table): static
    {
        if (!$this->Clients->contains($table)) {
            $this->Clients->add($table);
            $table->addTable($this);
        }

        return $this;
    }

    public function removeClient(Clients $table): static
    {
        if ($this->Clients->removeElement($table)) {
            $table->removeTable($this);
        }

        return $this;
    }

    /**
     * @return Collection<int, Reservations>
     */
    public function getReservations(): Collection
    {
        return $this->reservations;
    }

    public function addReservation(Reservations $reservation): static
    {
        if (!$this->reservations->contains($reservation)) {
            $this->reservations->add($reservation);
            $reservation->setTable($this);
        }

        return $this;
    }

    public function removeReservation(Reservations $reservation): static
    {
        if ($this->reservations->removeElement($reservation)) {
            // set the owning side to null (unless already changed)
            if ($reservation->getTables() === $this) {
                $reservation->setTable(null);
            }
        }

        return $this;
    }

    /**
     * @return Collection<int, StatutTables>
     */
    public function getStatutTables(): Collection
    {
        return $this->statutTables;
    }

    public function addStatutTable(StatutTables $statutTable): static
    {
        if (!$this->statutTables->contains($statutTable)) {
            $this->statutTables->add($statutTable);
            $statutTable->setTable($this);
        }

        return $this;
    }

    public function removeStatutTable(StatutTables $statutTable): static
    {
        if ($this->statutTables->removeElement($statutTable)) {
            // set the owning side to null (unless already changed)
            if ($statutTable->getTables() === $this) {
                $statutTable->setTable(null);
            }
        }

        return $this;
    }

    /**
     * @return Collection<int, Utilisateurs>
     */
    public function getUtilisateurs(): Collection
    {
        return $this->utilisateurs;
    }

    public function addUtilisateur(Utilisateurs $utilisateur): static
    {
        if (!$this->utilisateurs->contains($utilisateur)) {
            $this->utilisateurs->add($utilisateur);
            $utilisateur->addTable($this);
        }

        return $this;
    }

    public function removeUtilisateur(Utilisateurs $utilisateur): static
    {
        if ($this->utilisateurs->removeElement($utilisateur)) {
            $utilisateur->removeTable($this);
        }

        return $this;
    }
}
