id = $id; $this->status = $status; $this->recipient = $userId; $this->senderId = $senderId; $this->senderName = $senderName; $this->title = $title; $this->message = $message; $this->createdAt = $createdAt; $this->updatedAt = $updatedAt; } public function getStatus(): int { return $this->status; } public function getRecipient(): string { return $this->recipient; } public function getSenderId(): string { return $this->senderId; } public function getSenderName(): string { return $this->senderName; } public function getMessage(): string { return $this->message; } public function getId(): string { return $this->id; } public function getCreatedAt(): int { return strtotime($this->createdAt); } public function getUpdatedAt(): int { return strtotime($this->updatedAt); } public function setStatus($status): self { if (is_int($status)) { $this->status = $status; } else { $this->status = self::DEFAULT_STATUS; } $this->updatedAt = date('Y-m-d H:i:s'); return $this; } public function setId($id): self { if ($this->id === null) { $this->id = $id; } return $this; } public function getTitle(): string { return $this->title; } public function jsonSerialize(): array { return [ 'id' => $this->getId(), 'status' => $this->getStatus(), 'recipient' => $this->getRecipient(), 'sender' => $this->getSenderId(), 'senderName' => $this->getSenderId(), 'title' => $this->getTitle(), 'message' => $this->getMessage(), 'createdAt' => $this->getCreatedAt(), 'updatedAt' => $this->getUpdatedAt(), ]; } }