<?php
namespace App\Entity;
use App\Repository\ChatRepository;
use Doctrine\DBAL\Types\Types;
use Doctrine\ORM\Mapping as ORM;
#[ORM\Entity(repositoryClass: ChatRepository::class)]
class Chat
{
public const DISPLAY_RIGHT = 1;
public const DISPLAY_LEFT = 0;
#[ORM\Id]
#[ORM\GeneratedValue]
#[ORM\Column]
private ?int $id = null;
#[ORM\Column(type: Types::TEXT)]
private ?string $message = null;
#[ORM\Column]
private ?int $sendedBy = null;
#[ORM\Column]
private ?\DateTimeImmutable $addedAt = null;
#[ORM\Column(nullable: true)]
private ?\DateTimeImmutable $updatedAt = null;
#[ORM\Column]
private ?int $isActive = 1;
#[ORM\ManyToOne(inversedBy: 'chat')]
private ?Ticket $ticket = null;
#[ORM\ManyToOne(inversedBy: 'chat')]
private ?User $user = null;
public function __toString(): string
{
return $this->message;
}
public function __construct()
{
$this->setAddedAt(new \DateTimeImmutable());
}
public function getId(): ?int
{
return $this->id;
}
public function getMessage(): ?string
{
return $this->message;
}
public function setMessage(string $message): self
{
$this->message = $message;
return $this;
}
public function getSendedBy(): ?int
{
return $this->sendedBy;
}
public function setSendedBy(int $sendedBy): self
{
$this->sendedBy = $sendedBy;
return $this;
}
public function getAddedAt(): ?\DateTimeImmutable
{
return $this->addedAt;
}
public function setAddedAt(\DateTimeImmutable $addedAt): self
{
$this->addedAt = $addedAt;
return $this;
}
public function getUpdatedAt(): ?\DateTimeImmutable
{
return $this->updatedAt;
}
public function setUpdatedAt(?\DateTimeImmutable $updatedAt): self
{
$this->updatedAt = $updatedAt;
return $this;
}
public function getIsActive(): ?int
{
return $this->isActive;
}
public function setIsActive(int $isActive): self
{
$this->isActive = $isActive;
return $this;
}
public function getTicket(): ?Ticket
{
return $this->ticket;
}
public function setTicket(?Ticket $ticket): self
{
$this->ticket = $ticket;
return $this;
}
public function getUser(): ?User
{
return $this->user;
}
public function setUser(?User $user): self
{
$this->user = $user;
return $this;
}
}