diff --git a/src/Bot/Model/Entity/Chat/Chat.php b/src/Bot/Model/Entity/Chat/Chat.php index ff59a90..8282729 100644 --- a/src/Bot/Model/Entity/Chat/Chat.php +++ b/src/Bot/Model/Entity/Chat/Chat.php @@ -100,7 +100,7 @@ class Chat implements ModelInterface /** * @var ChatLastMessage $lastMessage * - * @Type("ChatLastMessage") + * @Type("RetailCrm\Mg\Bot\Model\Entity\Chat\ChatLastMessage") * @Accessor(getter="getLastMessage",setter="setLastMessage") */ private $lastMessage; diff --git a/src/Bot/Model/Entity/Chat/ChatLastMessage.php b/src/Bot/Model/Entity/Chat/ChatLastMessage.php index 7089b6c..ea8eeeb 100644 --- a/src/Bot/Model/Entity/Chat/ChatLastMessage.php +++ b/src/Bot/Model/Entity/Chat/ChatLastMessage.php @@ -13,6 +13,7 @@ namespace RetailCrm\Mg\Bot\Model\Entity\Chat; use JMS\Serializer\Annotation\Accessor; use JMS\Serializer\Annotation\SkipWhenEmpty; use JMS\Serializer\Annotation\Type; +use RetailCrm\Mg\Bot\Model\Entity\Customer; use RetailCrm\Mg\Bot\Model\ModelInterface; /** @@ -34,7 +35,7 @@ class ChatLastMessage implements ModelInterface /** * @var \DateTime $time * - * @Type("DateTime<'Y-m-d\TH:i:s\.u\Z'>") + * @Type("DateTime<'Y-m-d\TH:i:sP'>") * @Accessor(getter="getTime",setter="setTime") * @SkipWhenEmpty() */ @@ -49,6 +50,77 @@ class ChatLastMessage implements ModelInterface */ private $type; + /** + * @var string $scope + * + * @Type("string") + * @Accessor(getter="getScope",setter="setScope") + * @SkipWhenEmpty() + */ + private $scope; + + /** + * @var int $chatId + * + * @Type("int") + * @Accessor(getter="getChatId",setter="setChatId") + * @SkipWhenEmpty() + */ + private $chatId; + + /** + * @var bool $isRead + * + * @Type("bool") + * @Accessor(getter="getIsRead",setter="setIsRead") + * @SkipWhenEmpty() + */ + private $isRead; + + /** + * @var bool $isEdit + * + * @Type("bool") + * @Accessor(getter="getIsEdit",setter="setIsEdit") + * @SkipWhenEmpty() + */ + private $isEdit; + + /** + * @var string $status + * + * @Type("string") + * @Accessor(getter="getStatus",setter="setStatus") + * @SkipWhenEmpty() + */ + private $status; + + /** + * @var Customer $from + * + * @Type("RetailCrm\Mg\Bot\Model\Entity\Customer") + * @Accessor(getter="getFrom",setter="setFrom") + */ + private $from; + + /** + * @var string $content + * + * @Type("string") + * @Accessor(getter="getContent",setter="setContent") + * @SkipWhenEmpty() + */ + private $content; + + /** + * @var \RetailCrm\Mg\Bot\Model\Entity\Message\MessageQuote $quote + * + * @Type("RetailCrm\Mg\Bot\Model\Entity\Message\MessageQuote") + * @Accessor(getter="getQuote",setter="setQuote") + * @SkipWhenEmpty() + */ + private $quote; + /** * @return int|null */ @@ -96,4 +168,132 @@ class ChatLastMessage implements ModelInterface { $this->type = $type; } + + /** + * @return mixed + */ + public function getScope() + { + return $this->scope; + } + + /** + * @param mixed $scope + */ + public function setScope($scope): void + { + $this->scope = $scope; + } + + /** + * @return mixed + */ + public function getChatId() + { + return $this->chatId; + } + + /** + * @param mixed $chatId + */ + public function setChatId($chatId): void + { + $this->chatId = $chatId; + } + + /** + * @return mixed + */ + public function getIsRead() + { + return $this->isRead; + } + + /** + * @param mixed $isRead + */ + public function setIsRead($isRead): void + { + $this->isRead = $isRead; + } + + /** + * @return mixed + */ + public function getIsEdit() + { + return $this->isEdit; + } + + /** + * @param mixed $isEdit + */ + public function setIsEdit($isEdit): void + { + $this->isEdit = $isEdit; + } + + /** + * @return mixed + */ + public function getStatus() + { + return $this->status; + } + + /** + * @param mixed $status + */ + public function setStatus($status): void + { + $this->status = $status; + } + + /** + * @return mixed + */ + public function getFrom() + { + return $this->from; + } + + /** + * @param mixed $from + */ + public function setFrom($from): void + { + $this->from = $from; + } + + /** + * @return mixed + */ + public function getContent() + { + return $this->content; + } + + /** + * @param mixed $content + */ + public function setContent($content): void + { + $this->content = $content; + } + + /** + * @return mixed + */ + public function getQuote() + { + return $this->quote; + } + + /** + * @param mixed $quote + */ + public function setQuote($quote): void + { + $this->quote = $quote; + } } diff --git a/src/Bot/Model/Entity/Message/MessageQuote.php b/src/Bot/Model/Entity/Message/MessageQuote.php new file mode 100644 index 0000000..d014ee5 --- /dev/null +++ b/src/Bot/Model/Entity/Message/MessageQuote.php @@ -0,0 +1,172 @@ +") + * @Accessor(getter="getTime",setter="setTime") + */ + private $time; + + /** + * @var string $content + * + * @Type("string") + * @Accessor(getter="getContent",setter="setContent") + */ + private $content; + + /** + * @var array $items + * + * @Type("array") + * @Accessor(getter="getItems",setter="setItems") + * @SkipWhenEmpty() + */ + private $items; + + /** + * @return string|null + */ + public function getId(): ?string + { + return $this->id; + } + + /** + * @param string $id + */ + public function setId(string $id) + { + $this->id = $id; + } + + /** + * @return string|null + */ + public function getType(): ?string + { + return $this->type; + } + + /** + * @param string $type + */ + public function setType(string $type) + { + $this->type = $type; + } + + /** + * @return User|null + */ + public function getFrom(): ?User + { + return $this->from; + } + + /** + * @param User $from + */ + public function setFrom(User $from) + { + $this->from = $from; + } + + /** + * @return \DateTime + */ + public function getTime(): ?\DateTime + { + return $this->time; + } + + /** + * @param \DateTime $time + */ + public function setTime(\DateTime $time) + { + $this->time = $time; + } + + /** + * @return string + */ + public function getContent() + { + return $this->content; + } + + /** + * @param string $content + */ + public function setContent(string $content): void + { + $this->content = $content; + } + + /** + * @return array|null + */ + public function getItems(): ?array + { + return $this->items; + } + + /** + * @param array $items + */ + public function setItems(array $items) + { + $this->items = $items; + } +} diff --git a/tests/Resources/chats.json b/tests/Resources/chats.json index 1bd6785..44c0d74 100644 --- a/tests/Resources/chats.json +++ b/tests/Resources/chats.json @@ -108,9 +108,28 @@ "last_name": "Петрович" }, "author_id": 0, - "last_message": null, + "last_message": { + "id": 1, + "time": "2022-12-21T17:15:54+01:00", + "type": "command", + "scope": "private", + "chat_id": 1053, + "is_read": false, + "is_edit": false, + "status": "received", + "from": { + "id": 2, + "external_id": "12", + "type": "user", + "avatar": null, + "name": "Cuenta Soporte", + "first_name": "Cuenta", + "last_name": "Soporte", + "is_technical_account": true + } + }, "last_activity": "2019-06-13T11:07:14+03:00", "created_at": "2019-06-11T07:34:16.082957Z", "updated_at": "2019-06-16T08:10:28.657972Z" } -] \ No newline at end of file +]