<?php
declare(strict_types=1);

namespace App\Entity\Booking;

use App\Attribute\ActivityYearConstraintAware;
use App\Attribute\OrganizationDefaultValue;
use App\Entity\Traits\ActivityYearTrait;
use Doctrine\ORM\Mapping as ORM;
use App\Enum\Booking\VisibilityEnum;
use Ramsey\Uuid\Doctrine\UuidGenerator;
use Ramsey\Uuid\UuidInterface;
use Symfony\Component\Validator\Constraints as Assert;

/**
 * Classe ... qui ...
 */
#[ActivityYearConstraintAware(startYearFieldName: "startYear", endYearFieldName: "endYear")]
#[OrganizationDefaultValue(fieldName: "organization")]
#[ORM\MappedSuperclass]
abstract class AbstractBooking
{
    use ActivityYearTrait;

    #[ORM\Id]
    #[ORM\Column]
    #[ORM\GeneratedValue]
    protected ?int $id = null;

    #[ORM\Column]
    protected string $name;

    #[ORM\Column(type: 'datetime', nullable: true)]
    protected ?\DateTimeInterface $datetimeStart = null;

    #[ORM\Column(type: 'datetime', nullable: true)]
    protected ?\DateTimeInterface $datetimeEnd = null;

    #[ORM\Column(nullable: false)]
    #[Assert\Choice(callback: [VisibilityEnum::class, 'toArray'])]
    protected string $visibility;

    #[ORM\Column(unique: true)]
    protected string $uuid;

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

    /**
     * @return string
     */
    public function getName(): string
    {
        return $this->name;
    }

    /**
     * @param string $name
     */
    public function setName(string $name): void
    {
        $this->name = $name;
    }

    public function setDatetimeStart(\DateTimeInterface $datetimeStart = null) : self
    {
        $this->datetimeStart = $datetimeStart;

        return $this;
    }

    public function getDatetimeStart(): ?\DateTimeInterface
    {
        return $this->datetimeStart;
    }

    public function setDatetimeEnd(\DateTimeInterface $datetimeEnd = null) : self
    {
        $this->datetimeEnd = $datetimeEnd;

        return $this;
    }

    public function getDatetimeEnd(): ?\DateTimeInterface
    {
        return $this->datetimeEnd;
    }

    /**
     * @return string|null
     */
    public function getVisibility(): ?string
    {
        return $this->visibility;
    }

    /**
     * @param string|null $visibility
     */
    public function setVisibility(?string $visibility): void
    {
        $this->visibility = $visibility;
    }

    /**
     * @return string
     */
    public function getUuid(): string
    {
        return $this->uuid;
    }

    /**
     * @param string $uuid
     */
    public function setUuid(string $uuid): void
    {
        $this->uuid = $uuid;
    }
}
