<?php

namespace App\Entity;

use App\Repository\SlotRepository;
use Doctrine\ORM\Mapping as ORM;

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

    #[ORM\ManyToOne]
    #[ORM\JoinColumn(nullable: false)]
    private ?Period $period = null;

    #[ORM\ManyToOne]
    #[ORM\JoinColumn(nullable: false)]
    private ?Space $space = null;

    #[ORM\ManyToOne(inversedBy: 'slots')]
    #[ORM\JoinColumn(nullable: false)]
    private ?Event $event = null;

    #[ORM\Column]
    private ?\DateTime $startOn = null;

    #[ORM\Column]
    private ?\DateTime $endOn = null;

    #[ORM\Column(nullable: true)]
    private ?bool $unavailable = null;

    #[ORM\ManyToOne(inversedBy: 'slots')]
    private ?Party $party = null;

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

    public function getPeriod(): ?Period
    {
        return $this->period;
    }

    public function setPeriod(?Period $period): static
    {
        $this->period = $period;

        return $this;
    }

    public function getSpace(): ?Space
    {
        return $this->space;
    }

    public function setSpace(?Space $space): static
    {
        $this->space = $space;

        return $this;
    }

    public function getEvent(): ?Event
    {
        return $this->event;
    }

    public function setEvent(?Event $event): static
    {
        $this->event = $event;

        return $this;
    }

    public function getStartOn(): ?\DateTime
    {
        return $this->startOn;
    }

    public function setStartOn(\DateTime $startOn): static
    {
        $this->startOn = $startOn;

        return $this;
    }

    public function getEndOn(): ?\DateTime
    {
        return $this->endOn;
    }

    public function setEndOn(\DateTime $endOn): static
    {
        $this->endOn = $endOn;

        return $this;
    }

    public function isUnavailable(): ?bool
    {
        return $this->unavailable;
    }

    public function isAvailable(): ?bool
    {
        return !$this->unavailable;
    }

    public function setUnavailable(?bool $unavailable): static
    {
        $this->unavailable = $unavailable;

        return $this;
    }

    public function getParty(): ?Party
    {
        return $this->party;
    }

    public function setParty(?Party $party): static
    {
        $this->party = $party;

        return $this;
    }

}
