PluginProbe
Charitable – Donation & Fundraising Platform (Donation Forms, Recurring Donations & Fundraising Campaigns) / 1.8.13
Charitable – Donation & Fundraising Platform (Donation Forms, Recurring Donations & Fundraising Campaigns) v1.8.13
1.8.13 1.8.12.3 1.8.12.2 1.8.12.1 1.8.12 1.8.11.3 1.8.11.2 1.8.11.1 1.8.11 1.6.6 1.6.60 1.6.7 1.6.8 1.6.9 1.7.0 1.7.0.1 1.7.0.11 1.7.0.12 1.7.0.14 1.7.0.2 1.7.0.3 1.7.0.5 1.7.0.6 1.7.0.7 1.7.0.9 All 211 releases
charitable / vendor / square / square / src / Legacy / Models / AppointmentSegment.php

AppointmentSegment.php in Charitable – Donation & Fundraising Platform (Donation Forms, Recurring Donations & Fundraising Campaigns) 1.8.13, at vendor/square/square/src/Legacy/Models/AppointmentSegment.php

281 lines 7.4 KB
No matching file
Up and down to move Enter to open Esc to close
Raw Download Zip
1 <?php
2
3 declare(strict_types=1);
4
5 namespace Square\Legacy\Models;
6
7 use stdClass;
8
9 /**
10 * Defines an appointment segment of a booking.
11 */
12 class AppointmentSegment implements \JsonSerializable
13 {
14 /**
15 * @var array
16 */
17 private $durationMinutes = [];
18
19 /**
20 * @var array
21 */
22 private $serviceVariationId = [];
23
24 /**
25 * @var string
26 */
27 private $teamMemberId;
28
29 /**
30 * @var array
31 */
32 private $serviceVariationVersion = [];
33
34 /**
35 * @var int|null
36 */
37 private $intermissionMinutes;
38
39 /**
40 * @var bool|null
41 */
42 private $anyTeamMember;
43
44 /**
45 * @var string[]|null
46 */
47 private $resourceIds;
48
49 /**
50 * @param string $teamMemberId
51 */
52 public function __construct(string $teamMemberId)
53 {
54 $this->teamMemberId = $teamMemberId;
55 }
56
57 /**
58 * Returns Duration Minutes.
59 * The time span in minutes of an appointment segment.
60 */
61 public function getDurationMinutes(): ?int
62 {
63 if (count($this->durationMinutes) == 0) {
64 return null;
65 }
66 return $this->durationMinutes['value'];
67 }
68
69 /**
70 * Sets Duration Minutes.
71 * The time span in minutes of an appointment segment.
72 *
73 * @maps duration_minutes
74 */
75 public function setDurationMinutes(?int $durationMinutes): void
76 {
77 $this->durationMinutes['value'] = $durationMinutes;
78 }
79
80 /**
81 * Unsets Duration Minutes.
82 * The time span in minutes of an appointment segment.
83 */
84 public function unsetDurationMinutes(): void
85 {
86 $this->durationMinutes = [];
87 }
88
89 /**
90 * Returns Service Variation Id.
91 * The ID of the [CatalogItemVariation](entity:CatalogItemVariation) object representing the service
92 * booked in this segment.
93 */
94 public function getServiceVariationId(): ?string
95 {
96 if (count($this->serviceVariationId) == 0) {
97 return null;
98 }
99 return $this->serviceVariationId['value'];
100 }
101
102 /**
103 * Sets Service Variation Id.
104 * The ID of the [CatalogItemVariation](entity:CatalogItemVariation) object representing the service
105 * booked in this segment.
106 *
107 * @maps service_variation_id
108 */
109 public function setServiceVariationId(?string $serviceVariationId): void
110 {
111 $this->serviceVariationId['value'] = $serviceVariationId;
112 }
113
114 /**
115 * Unsets Service Variation Id.
116 * The ID of the [CatalogItemVariation](entity:CatalogItemVariation) object representing the service
117 * booked in this segment.
118 */
119 public function unsetServiceVariationId(): void
120 {
121 $this->serviceVariationId = [];
122 }
123
124 /**
125 * Returns Team Member Id.
126 * The ID of the [TeamMember](entity:TeamMember) object representing the team member booked in this
127 * segment.
128 */
129 public function getTeamMemberId(): string
130 {
131 return $this->teamMemberId;
132 }
133
134 /**
135 * Sets Team Member Id.
136 * The ID of the [TeamMember](entity:TeamMember) object representing the team member booked in this
137 * segment.
138 *
139 * @required
140 * @maps team_member_id
141 */
142 public function setTeamMemberId(string $teamMemberId): void
143 {
144 $this->teamMemberId = $teamMemberId;
145 }
146
147 /**
148 * Returns Service Variation Version.
149 * The current version of the item variation representing the service booked in this segment.
150 */
151 public function getServiceVariationVersion(): ?int
152 {
153 if (count($this->serviceVariationVersion) == 0) {
154 return null;
155 }
156 return $this->serviceVariationVersion['value'];
157 }
158
159 /**
160 * Sets Service Variation Version.
161 * The current version of the item variation representing the service booked in this segment.
162 *
163 * @maps service_variation_version
164 */
165 public function setServiceVariationVersion(?int $serviceVariationVersion): void
166 {
167 $this->serviceVariationVersion['value'] = $serviceVariationVersion;
168 }
169
170 /**
171 * Unsets Service Variation Version.
172 * The current version of the item variation representing the service booked in this segment.
173 */
174 public function unsetServiceVariationVersion(): void
175 {
176 $this->serviceVariationVersion = [];
177 }
178
179 /**
180 * Returns Intermission Minutes.
181 * Time between the end of this segment and the beginning of the subsequent segment.
182 */
183 public function getIntermissionMinutes(): ?int
184 {
185 return $this->intermissionMinutes;
186 }
187
188 /**
189 * Sets Intermission Minutes.
190 * Time between the end of this segment and the beginning of the subsequent segment.
191 *
192 * @maps intermission_minutes
193 */
194 public function setIntermissionMinutes(?int $intermissionMinutes): void
195 {
196 $this->intermissionMinutes = $intermissionMinutes;
197 }
198
199 /**
200 * Returns Any Team Member.
201 * Whether the customer accepts any team member, instead of a specific one, to serve this segment.
202 */
203 public function getAnyTeamMember(): ?bool
204 {
205 return $this->anyTeamMember;
206 }
207
208 /**
209 * Sets Any Team Member.
210 * Whether the customer accepts any team member, instead of a specific one, to serve this segment.
211 *
212 * @maps any_team_member
213 */
214 public function setAnyTeamMember(?bool $anyTeamMember): void
215 {
216 $this->anyTeamMember = $anyTeamMember;
217 }
218
219 /**
220 * Returns Resource Ids.
221 * The IDs of the seller-accessible resources used for this appointment segment.
222 *
223 * @return string[]|null
224 */
225 public function getResourceIds(): ?array
226 {
227 return $this->resourceIds;
228 }
229
230 /**
231 * Sets Resource Ids.
232 * The IDs of the seller-accessible resources used for this appointment segment.
233 *
234 * @maps resource_ids
235 *
236 * @param string[]|null $resourceIds
237 */
238 public function setResourceIds(?array $resourceIds): void
239 {
240 $this->resourceIds = $resourceIds;
241 }
242
243 /**
244 * Encode this object to JSON
245 *
246 * @param bool $asArrayWhenEmpty Whether to serialize this model as an array whenever no fields
247 * are set. (default: false)
248 *
249 * @return array|stdClass
250 */
251 #[\ReturnTypeWillChange] // @phan-suppress-current-line PhanUndeclaredClassAttribute for (php < 8.1)
252 public function jsonSerialize(bool $asArrayWhenEmpty = false)
253 {
254 $json = [];
255 if (!empty($this->durationMinutes)) {
256 $json['duration_minutes'] = $this->durationMinutes['value'];
257 }
258 if (!empty($this->serviceVariationId)) {
259 $json['service_variation_id'] = $this->serviceVariationId['value'];
260 }
261 $json['team_member_id'] = $this->teamMemberId;
262 if (!empty($this->serviceVariationVersion)) {
263 $json['service_variation_version'] = $this->serviceVariationVersion['value'];
264 }
265 if (isset($this->intermissionMinutes)) {
266 $json['intermission_minutes'] = $this->intermissionMinutes;
267 }
268 if (isset($this->anyTeamMember)) {
269 $json['any_team_member'] = $this->anyTeamMember;
270 }
271 if (isset($this->resourceIds)) {
272 $json['resource_ids'] = $this->resourceIds;
273 }
274 $json = array_filter($json, function ($val) {
275 return $val !== null;
276 });
277
278 return (!$asArrayWhenEmpty && empty($json)) ? new stdClass() : $json;
279 }
280 }
281