You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

83 lines
2.0 KiB

  1. <?php
  2. declare(strict_types=1);
  3. /**
  4. * SPDX-FileCopyrightText: 2022 Nextcloud GmbH and Nextcloud contributors
  5. * SPDX-License-Identifier: AGPL-3.0-or-later
  6. */
  7. namespace OCA\Talk\Model;
  8. use OCP\AppFramework\Db\Entity;
  9. use OCP\DB\Types;
  10. /**
  11. * @method void setRoomId(int $roomId)
  12. * @method int getRoomId()
  13. * @method void setMessageId(int $messageId)
  14. * @method int getMessageId()
  15. * @method void setMessageTime(int $messageTime)
  16. * @method int getMessageTime()
  17. * @method void setObjectType(string $objectType)
  18. * @method string getObjectType()
  19. * @method void setActorType(string $actorType)
  20. * @method string getActorType()
  21. * @method void setActorId(string $actorId)
  22. * @method string getActorId()
  23. */
  24. class Attachment extends Entity {
  25. public const TYPE_AUDIO = 'audio';
  26. public const TYPE_DECK_CARD = 'deckcard';
  27. public const TYPE_FILE = 'file';
  28. public const TYPE_LOCATION = 'location';
  29. public const TYPE_MEDIA = 'media';
  30. public const TYPE_OTHER = 'other';
  31. public const TYPE_POLL = 'poll';
  32. public const TYPE_RECORDING = 'recording';
  33. public const TYPE_VOICE = 'voice';
  34. public const ATTACHMENTS_NONE = 0;
  35. public const ATTACHMENTS_ATLEAST_ONE = 1;
  36. /** @var int */
  37. protected $roomId;
  38. /** @var int */
  39. protected $messageId;
  40. /** @var int */
  41. protected $messageTime;
  42. /** @var string */
  43. protected $objectType;
  44. /** @var string */
  45. protected $actorType;
  46. /** @var string */
  47. protected $actorId;
  48. public function __construct() {
  49. $this->addType('roomId', Types::BIGINT);
  50. $this->addType('messageId', Types::BIGINT);
  51. $this->addType('messageTime', Types::BIGINT);
  52. $this->addType('objectType', Types::STRING);
  53. $this->addType('actorType', Types::STRING);
  54. $this->addType('actorId', Types::STRING);
  55. }
  56. /**
  57. * @return array
  58. */
  59. public function asArray(): array {
  60. return [
  61. 'id' => $this->getId(),
  62. 'room_id' => $this->getRoomId(),
  63. 'message_id' => $this->getMessageId(),
  64. 'message_time' => $this->getMessageTime(),
  65. 'object_type' => $this->getObjectType(),
  66. 'actor_type' => $this->getActorType(),
  67. 'actor_id' => $this->getActorId(),
  68. ];
  69. }
  70. }