aboutsummaryrefslogtreecommitdiffstats
path: root/lib/public/User/IOutOfOfficeData.php
blob: e3a4e2773bb47b9eb43ebf2647d7409228716dec (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
<?php

declare(strict_types=1);

/**
 * SPDX-FileCopyrightText: 2023 Nextcloud GmbH and Nextcloud contributors
 * SPDX-License-Identifier: AGPL-3.0-or-later
 */

namespace OCP\User;

use JsonSerializable;
use OCP\IUser;

/**
 * DTO to hold out-of-office information of a user
 *
 * @psalm-type OutOfOfficeData = array{
 *      id: string,
 *      userId: string,
 *      startDate: int,
 *      endDate: int,
 *      shortMessage: string,
 *      message: string,
 * 		replacementUserId: ?string,
 * 		replacementUserDisplayName: ?string
 * }
 *
 * @since 28.0.0
 */
interface IOutOfOfficeData extends JsonSerializable {
	/**
	 * Get the unique token assigned to the current out-of-office event
	 *
	 * @since 28.0.0
	 */
	public function getId(): string;

	/**
	 * @since 28.0.0
	 */
	public function getUser(): IUser;

	/**
	 * Get the accurate out-of-office start date
	 *
	 * This event is not guaranteed to be emitted exactly at start date
	 *
	 * @since 28.0.0
	 */
	public function getStartDate(): int;

	/**
	 * Get the (preliminary) out-of-office end date
	 *
	 * @since 28.0.0
	 */
	public function getEndDate(): int;

	/**
	 * Get the short summary text displayed in the user status and similar
	 *
	 * @since 28.0.0
	 */
	public function getShortMessage(): string;

	/**
	 * Get the long out-of-office message for auto responders and similar
	 *
	 * @since 28.0.0
	 */
	public function getMessage(): string;

	/**
	 * Get the replacement user id for auto responders and similar
	 *
	 * @since 30.0.0
	 */
	public function getReplacementUserId(): ?string;

	/**
	 * Get the replacement user displayName for auto responders and similar
	 *
	 * @since 30.0.0
	 */
	public function getReplacementUserDisplayName(): ?string;

	/**
	 * @return OutOfOfficeData
	 *
	 * @since 28.0.0
	 */
	public function jsonSerialize(): array;
}