<?php

declare(strict_types=1);

namespace App\Entity\SimulationSession;

use ApiPlatform\Metadata\ApiResource;
use App\Entity\Access\Access;
use App\Entity\Token\Token;
use Doctrine\ORM\Mapping as ORM;

#[ApiResource(operations: [])]
#[ORM\Entity]
class SimulationSession
{
    #[ORM\Id]
    #[ORM\Column]
    #[ORM\GeneratedValue]
    private int $id;

    /** -- Warning : auto-generated property, checkup the attribute options -- */
    #[ORM\Column]
    protected mixed $initiatorIp;

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

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

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

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

    /** -- Warning : auto-generated property, checkup the attribute options -- */
    #[ORM\Column(type: 'integer', options: ['nullable' => true])]
    protected int $legacyId;

    /** -- Warning : auto-generated property, checkup the attribute options -- */
    #[ORM\Column(type: 'integer', options: ['nullable' => true])]
    protected int $createdBy;

    /** -- Warning : auto-generated property, checkup the attribute options -- */
    #[ORM\Column(type: 'integer', options: ['nullable' => true])]
    protected int $updatedBy;

    /** -- Warning : auto-generated property, checkup the attribute options -- */
    #[ORM\Column(options: ['default' => false])]
    protected bool $draft;

    #[ORM\ManyToOne(targetEntity: Access::class, cascade: [], inversedBy: 'simulationSessionAccessInitiators')]
    #[ORM\JoinColumn(nullable: false)]
    protected Access $accessInitiator;

    #[ORM\ManyToOne(targetEntity: Access::class, cascade: [], inversedBy: 'simulationSessionAccessSimulateds')]
    #[ORM\JoinColumn(nullable: false)]
    protected Access $accessSimulated;

    #[ORM\OneToOne(mappedBy: 'simulationSession', targetEntity: Token::class, cascade: ['persist'])]
    protected ?Token $token;

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

    public function setId(int $id): self
    {
        $this->id = $id;

        return $this;
    }

    public function getInitiatorIp(): mixed
    {
        return $this->initiatorIp;
    }

    public function setInitiatorIp(mixed $initiatorIp): self
    {
        $this->initiatorIp = $initiatorIp;

        return $this;
    }

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

    public function setExpiryDate(?\DateTimeInterface $expiryDate): self
    {
        $this->expiryDate = $expiryDate;

        return $this;
    }

    public function getAlreadyUsed(): bool
    {
        return $this->alreadyUsed;
    }

    public function setAlreadyUsed(bool $alreadyUsed): self
    {
        $this->alreadyUsed = $alreadyUsed;

        return $this;
    }

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

    public function setCreateDate(?\DateTimeInterface $createDate): self
    {
        $this->createDate = $createDate;

        return $this;
    }

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

    public function setUpdateDate(?\DateTimeInterface $updateDate): self
    {
        $this->updateDate = $updateDate;

        return $this;
    }

    public function getLegacyId(): int
    {
        return $this->legacyId;
    }

    public function setLegacyId(int $legacyId): self
    {
        $this->legacyId = $legacyId;

        return $this;
    }

    public function getCreatedBy(): int
    {
        return $this->createdBy;
    }

    public function setCreatedBy(int $createdBy): self
    {
        $this->createdBy = $createdBy;

        return $this;
    }

    public function getUpdatedBy(): int
    {
        return $this->updatedBy;
    }

    public function setUpdatedBy(int $updatedBy): self
    {
        $this->updatedBy = $updatedBy;

        return $this;
    }

    public function getDraft(): bool
    {
        return $this->draft;
    }

    public function setDraft(bool $draft): self
    {
        $this->draft = $draft;

        return $this;
    }

    public function getAccessInitiator(): Access
    {
        return $this->accessInitiator;
    }

    public function setAccessInitiator(Access $accessInitiator): self
    {
        $this->accessInitiator = $accessInitiator;

        return $this;
    }

    public function getAccessSimulated(): Access
    {
        return $this->accessSimulated;
    }

    public function setAccessSimulated(Access $accessSimulated): self
    {
        $this->accessSimulated = $accessSimulated;

        return $this;
    }

    public function getToken(): ?Token
    {
        return $this->token;
    }

    public function setToken(?Token $token): self
    {
        $this->token = $token;

        return $this;
    }
}
