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.

71 lines
1.9 KiB

  1. <?php
  2. declare(strict_types=1);
  3. /**
  4. * @copyright Copyright (c) 2023 Joas Schilling <coding@schilljs.com>
  5. *
  6. * @license GNU AGPL version 3 or any later version
  7. *
  8. * This program is free software: you can redistribute it and/or modify
  9. * it under the terms of the GNU Affero General Public License as
  10. * published by the Free Software Foundation, either version 3 of the
  11. * License, or (at your option) any later version.
  12. *
  13. * This program is distributed in the hope that it will be useful,
  14. * but WITHOUT ANY WARRANTY; without even the implied warranty of
  15. * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
  16. * GNU Affero General Public License for more details.
  17. *
  18. * You should have received a copy of the GNU Affero General Public License
  19. * along with this program. If not, see <http://www.gnu.org/licenses/>.
  20. *
  21. */
  22. namespace OCA\Talk\Events;
  23. use OCA\Talk\Participant;
  24. use OCA\Talk\Room;
  25. abstract class AParticipantModifiedEvent extends RoomEvent {
  26. public const PROPERTY_IN_CALL = 'inCall';
  27. public const PROPERTY_NAME = 'name';
  28. public const PROPERTY_PERMISSIONS = 'permissions';
  29. public const PROPERTY_TYPE = 'type';
  30. public const DETAIL_IN_CALL_SILENT = 'silent';
  31. public const DETAIL_IN_CALL_END_FOR_EVERYONE = 'endForEveryone';
  32. /**
  33. * @param self::PROPERTY_* $property
  34. * @param array<self::DETAIL_*, bool> $details
  35. */
  36. public function __construct(
  37. Room $room,
  38. protected Participant $participant,
  39. protected string $property,
  40. protected string|int $newValue,
  41. protected string|int|null $oldValue = null,
  42. protected array $details = [],
  43. ) {
  44. parent::__construct($room);
  45. }
  46. public function getProperty(): string {
  47. return $this->property;
  48. }
  49. public function getNewValue(): string|int {
  50. return $this->newValue;
  51. }
  52. public function getOldValue(): string|int|null {
  53. return $this->oldValue;
  54. }
  55. /**
  56. * @param self::DETAIL_* $detail
  57. */
  58. public function getDetail(string $detail): ?bool {
  59. return $this->details[$detail] ?? null;
  60. }
  61. }