1
0

OutOfOfficeData.php 1.5 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970
  1. <?php
  2. declare(strict_types=1);
  3. /**
  4. * SPDX-FileCopyrightText: 2023 Nextcloud GmbH and Nextcloud contributors
  5. * SPDX-License-Identifier: AGPL-3.0-or-later
  6. */
  7. namespace OC\User;
  8. use OCP\IUser;
  9. use OCP\User\IOutOfOfficeData;
  10. class OutOfOfficeData implements IOutOfOfficeData {
  11. public function __construct(private string $id,
  12. private IUser $user,
  13. private int $startDate,
  14. private int $endDate,
  15. private string $shortMessage,
  16. private string $message,
  17. private ?string $replacementUserId,
  18. private ?string $replacementUserDisplayName) {
  19. }
  20. public function getId(): string {
  21. return $this->id;
  22. }
  23. public function getUser(): IUser {
  24. return $this->user;
  25. }
  26. public function getStartDate(): int {
  27. return $this->startDate;
  28. }
  29. public function getEndDate(): int {
  30. return $this->endDate;
  31. }
  32. public function getShortMessage(): string {
  33. return $this->shortMessage;
  34. }
  35. public function getMessage(): string {
  36. return $this->message;
  37. }
  38. public function getReplacementUserId(): ?string {
  39. return $this->replacementUserId;
  40. }
  41. public function getReplacementUserDisplayName(): ?string {
  42. return $this->replacementUserDisplayName;
  43. }
  44. public function jsonSerialize(): array {
  45. return [
  46. 'id' => $this->getId(),
  47. 'userId' => $this->getUser()->getUID(),
  48. 'startDate' => $this->getStartDate(),
  49. 'endDate' => $this->getEndDate(),
  50. 'shortMessage' => $this->getShortMessage(),
  51. 'message' => $this->getMessage(),
  52. 'replacementUserId' => $this->getReplacementUserId(),
  53. 'replacementUserDisplayName' => $this->getReplacementUserDisplayName(),
  54. ];
  55. }
  56. }