<?php
namespace App\Entity;
use App\Repository\MessageRepository;
use App\Entity\Traits\Timestampable;
use Doctrine\DBAL\Types\Types;
use Doctrine\ORM\Mapping as ORM;
use JMS\Serializer\Annotation\Groups;
#[ORM\HasLifecycleCallbacks]
#[ORM\Entity(repositoryClass: MessageRepository::class)]
class Message
{
use Timestampable;
#[ORM\Id]
#[ORM\GeneratedValue]
#[ORM\Column]
#[Groups(['chatView', 'singleMessage'])]
private ?int $id = null;
#[ORM\Column(type: Types::TEXT)]
#[Groups(['chatView', 'chatAllList', 'singleMessage'])]
private ?string $content = null;
#[ORM\Column(length: 255, nullable: true)]
#[Groups(['chatView'])]
private ?string $fileName = null;
#[ORM\ManyToOne(inversedBy: 'messages')]
#[ORM\JoinColumn(nullable: false)]
#[Groups(['chatView', 'chatAllList', 'singleMessage'])]
private ?UserYear $author = null;
#[ORM\ManyToOne(inversedBy: 'messages')]
#[ORM\JoinColumn(nullable: false)]
private ?Chat $chat = null;
#[ORM\Column]
#[Groups(['chatView', 'singleMessage'])]
private ?bool $isReaded = null;
#[ORM\Column]
#[Groups(['chatView', 'singleMessage'])]
private ?bool $isDeleted = null;
public function getId(): ?int
{
return $this->id;
}
public function __toString()
{
return $this->id;
}
public function getContent(): ?string
{
return $this->content;
}
public function setContent(string $content): static
{
$this->content = $content;
return $this;
}
public function getFileName(): ?string
{
return $this->fileName;
}
public function setFileName(?string $fileName): static
{
$this->fileName = $fileName;
return $this;
}
public function getAuthor(): ?UserYear
{
return $this->author;
}
public function setAuthor(?UserYear $author): static
{
$this->author = $author;
return $this;
}
public function getChat(): ?Chat
{
return $this->chat;
}
public function setChat(?Chat $chat): static
{
$this->chat = $chat;
return $this;
}
public function isIsReaded(): ?bool
{
return $this->isReaded;
}
public function setIsReaded(bool $isReaded): static
{
$this->isReaded = $isReaded;
return $this;
}
public function isIsDeleted(): ?bool
{
return $this->isDeleted;
}
public function setIsDeleted(bool $isDeleted): static
{
$this->isDeleted = $isDeleted;
return $this;
}
}