| 1 |
<?php |
| 2 |
|
| 3 |
declare(strict_types=1); |
| 4 |
|
| 5 |
namespace Square\Legacy\Models; |
| 6 |
|
| 7 |
use stdClass; |
| 8 |
|
| 9 |
class ListBookingsRequest implements \JsonSerializable |
| 10 |
{ |
| 11 |
/** |
| 12 |
* @var array |
| 13 |
*/ |
| 14 |
private $limit = []; |
| 15 |
|
| 16 |
/** |
| 17 |
* @var array |
| 18 |
*/ |
| 19 |
private $cursor = []; |
| 20 |
|
| 21 |
/** |
| 22 |
* @var array |
| 23 |
*/ |
| 24 |
private $customerId = []; |
| 25 |
|
| 26 |
/** |
| 27 |
* @var array |
| 28 |
*/ |
| 29 |
private $teamMemberId = []; |
| 30 |
|
| 31 |
/** |
| 32 |
* @var array |
| 33 |
*/ |
| 34 |
private $locationId = []; |
| 35 |
|
| 36 |
/** |
| 37 |
* @var array |
| 38 |
*/ |
| 39 |
private $startAtMin = []; |
| 40 |
|
| 41 |
/** |
| 42 |
* @var array |
| 43 |
*/ |
| 44 |
private $startAtMax = []; |
| 45 |
|
| 46 |
/** |
| 47 |
* Returns Limit. |
| 48 |
* The maximum number of results per page to return in a paged response. |
| 49 |
*/ |
| 50 |
public function getLimit(): ?int |
| 51 |
{ |
| 52 |
if (count($this->limit) == 0) { |
| 53 |
return null; |
| 54 |
} |
| 55 |
return $this->limit['value']; |
| 56 |
} |
| 57 |
|
| 58 |
/** |
| 59 |
* Sets Limit. |
| 60 |
* The maximum number of results per page to return in a paged response. |
| 61 |
* |
| 62 |
* @maps limit |
| 63 |
*/ |
| 64 |
public function setLimit(?int $limit): void |
| 65 |
{ |
| 66 |
$this->limit['value'] = $limit; |
| 67 |
} |
| 68 |
|
| 69 |
/** |
| 70 |
* Unsets Limit. |
| 71 |
* The maximum number of results per page to return in a paged response. |
| 72 |
*/ |
| 73 |
public function unsetLimit(): void |
| 74 |
{ |
| 75 |
$this->limit = []; |
| 76 |
} |
| 77 |
|
| 78 |
/** |
| 79 |
* Returns Cursor. |
| 80 |
* The pagination cursor from the preceding response to return the next page of the results. Do not set |
| 81 |
* this when retrieving the first page of the results. |
| 82 |
*/ |
| 83 |
public function getCursor(): ?string |
| 84 |
{ |
| 85 |
if (count($this->cursor) == 0) { |
| 86 |
return null; |
| 87 |
} |
| 88 |
return $this->cursor['value']; |
| 89 |
} |
| 90 |
|
| 91 |
/** |
| 92 |
* Sets Cursor. |
| 93 |
* The pagination cursor from the preceding response to return the next page of the results. Do not set |
| 94 |
* this when retrieving the first page of the results. |
| 95 |
* |
| 96 |
* @maps cursor |
| 97 |
*/ |
| 98 |
public function setCursor(?string $cursor): void |
| 99 |
{ |
| 100 |
$this->cursor['value'] = $cursor; |
| 101 |
} |
| 102 |
|
| 103 |
/** |
| 104 |
* Unsets Cursor. |
| 105 |
* The pagination cursor from the preceding response to return the next page of the results. Do not set |
| 106 |
* this when retrieving the first page of the results. |
| 107 |
*/ |
| 108 |
public function unsetCursor(): void |
| 109 |
{ |
| 110 |
$this->cursor = []; |
| 111 |
} |
| 112 |
|
| 113 |
/** |
| 114 |
* Returns Customer Id. |
| 115 |
* The [customer](entity:Customer) for whom to retrieve bookings. If this is not set, bookings for all |
| 116 |
* customers are retrieved. |
| 117 |
*/ |
| 118 |
public function getCustomerId(): ?string |
| 119 |
{ |
| 120 |
if (count($this->customerId) == 0) { |
| 121 |
return null; |
| 122 |
} |
| 123 |
return $this->customerId['value']; |
| 124 |
} |
| 125 |
|
| 126 |
/** |
| 127 |
* Sets Customer Id. |
| 128 |
* The [customer](entity:Customer) for whom to retrieve bookings. If this is not set, bookings for all |
| 129 |
* customers are retrieved. |
| 130 |
* |
| 131 |
* @maps customer_id |
| 132 |
*/ |
| 133 |
public function setCustomerId(?string $customerId): void |
| 134 |
{ |
| 135 |
$this->customerId['value'] = $customerId; |
| 136 |
} |
| 137 |
|
| 138 |
/** |
| 139 |
* Unsets Customer Id. |
| 140 |
* The [customer](entity:Customer) for whom to retrieve bookings. If this is not set, bookings for all |
| 141 |
* customers are retrieved. |
| 142 |
*/ |
| 143 |
public function unsetCustomerId(): void |
| 144 |
{ |
| 145 |
$this->customerId = []; |
| 146 |
} |
| 147 |
|
| 148 |
/** |
| 149 |
* Returns Team Member Id. |
| 150 |
* The team member for whom to retrieve bookings. If this is not set, bookings of all members are |
| 151 |
* retrieved. |
| 152 |
*/ |
| 153 |
public function getTeamMemberId(): ?string |
| 154 |
{ |
| 155 |
if (count($this->teamMemberId) == 0) { |
| 156 |
return null; |
| 157 |
} |
| 158 |
return $this->teamMemberId['value']; |
| 159 |
} |
| 160 |
|
| 161 |
/** |
| 162 |
* Sets Team Member Id. |
| 163 |
* The team member for whom to retrieve bookings. If this is not set, bookings of all members are |
| 164 |
* retrieved. |
| 165 |
* |
| 166 |
* @maps team_member_id |
| 167 |
*/ |
| 168 |
public function setTeamMemberId(?string $teamMemberId): void |
| 169 |
{ |
| 170 |
$this->teamMemberId['value'] = $teamMemberId; |
| 171 |
} |
| 172 |
|
| 173 |
/** |
| 174 |
* Unsets Team Member Id. |
| 175 |
* The team member for whom to retrieve bookings. If this is not set, bookings of all members are |
| 176 |
* retrieved. |
| 177 |
*/ |
| 178 |
public function unsetTeamMemberId(): void |
| 179 |
{ |
| 180 |
$this->teamMemberId = []; |
| 181 |
} |
| 182 |
|
| 183 |
/** |
| 184 |
* Returns Location Id. |
| 185 |
* The location for which to retrieve bookings. If this is not set, all locations' bookings are |
| 186 |
* retrieved. |
| 187 |
*/ |
| 188 |
public function getLocationId(): ?string |
| 189 |
{ |
| 190 |
if (count($this->locationId) == 0) { |
| 191 |
return null; |
| 192 |
} |
| 193 |
return $this->locationId['value']; |
| 194 |
} |
| 195 |
|
| 196 |
/** |
| 197 |
* Sets Location Id. |
| 198 |
* The location for which to retrieve bookings. If this is not set, all locations' bookings are |
| 199 |
* retrieved. |
| 200 |
* |
| 201 |
* @maps location_id |
| 202 |
*/ |
| 203 |
public function setLocationId(?string $locationId): void |
| 204 |
{ |
| 205 |
$this->locationId['value'] = $locationId; |
| 206 |
} |
| 207 |
|
| 208 |
/** |
| 209 |
* Unsets Location Id. |
| 210 |
* The location for which to retrieve bookings. If this is not set, all locations' bookings are |
| 211 |
* retrieved. |
| 212 |
*/ |
| 213 |
public function unsetLocationId(): void |
| 214 |
{ |
| 215 |
$this->locationId = []; |
| 216 |
} |
| 217 |
|
| 218 |
/** |
| 219 |
* Returns Start at Min. |
| 220 |
* The RFC 3339 timestamp specifying the earliest of the start time. If this is not set, the current |
| 221 |
* time is used. |
| 222 |
*/ |
| 223 |
public function getStartAtMin(): ?string |
| 224 |
{ |
| 225 |
if (count($this->startAtMin) == 0) { |
| 226 |
return null; |
| 227 |
} |
| 228 |
return $this->startAtMin['value']; |
| 229 |
} |
| 230 |
|
| 231 |
/** |
| 232 |
* Sets Start at Min. |
| 233 |
* The RFC 3339 timestamp specifying the earliest of the start time. If this is not set, the current |
| 234 |
* time is used. |
| 235 |
* |
| 236 |
* @maps start_at_min |
| 237 |
*/ |
| 238 |
public function setStartAtMin(?string $startAtMin): void |
| 239 |
{ |
| 240 |
$this->startAtMin['value'] = $startAtMin; |
| 241 |
} |
| 242 |
|
| 243 |
/** |
| 244 |
* Unsets Start at Min. |
| 245 |
* The RFC 3339 timestamp specifying the earliest of the start time. If this is not set, the current |
| 246 |
* time is used. |
| 247 |
*/ |
| 248 |
public function unsetStartAtMin(): void |
| 249 |
{ |
| 250 |
$this->startAtMin = []; |
| 251 |
} |
| 252 |
|
| 253 |
/** |
| 254 |
* Returns Start at Max. |
| 255 |
* The RFC 3339 timestamp specifying the latest of the start time. If this is not set, the time of 31 |
| 256 |
* days after `start_at_min` is used. |
| 257 |
*/ |
| 258 |
public function getStartAtMax(): ?string |
| 259 |
{ |
| 260 |
if (count($this->startAtMax) == 0) { |
| 261 |
return null; |
| 262 |
} |
| 263 |
return $this->startAtMax['value']; |
| 264 |
} |
| 265 |
|
| 266 |
/** |
| 267 |
* Sets Start at Max. |
| 268 |
* The RFC 3339 timestamp specifying the latest of the start time. If this is not set, the time of 31 |
| 269 |
* days after `start_at_min` is used. |
| 270 |
* |
| 271 |
* @maps start_at_max |
| 272 |
*/ |
| 273 |
public function setStartAtMax(?string $startAtMax): void |
| 274 |
{ |
| 275 |
$this->startAtMax['value'] = $startAtMax; |
| 276 |
} |
| 277 |
|
| 278 |
/** |
| 279 |
* Unsets Start at Max. |
| 280 |
* The RFC 3339 timestamp specifying the latest of the start time. If this is not set, the time of 31 |
| 281 |
* days after `start_at_min` is used. |
| 282 |
*/ |
| 283 |
public function unsetStartAtMax(): void |
| 284 |
{ |
| 285 |
$this->startAtMax = []; |
| 286 |
} |
| 287 |
|
| 288 |
/** |
| 289 |
* Encode this object to JSON |
| 290 |
* |
| 291 |
* @param bool $asArrayWhenEmpty Whether to serialize this model as an array whenever no fields |
| 292 |
* are set. (default: false) |
| 293 |
* |
| 294 |
* @return array|stdClass |
| 295 |
*/ |
| 296 |
#[\ReturnTypeWillChange] // @phan-suppress-current-line PhanUndeclaredClassAttribute for (php < 8.1) |
| 297 |
public function jsonSerialize(bool $asArrayWhenEmpty = false) |
| 298 |
{ |
| 299 |
$json = []; |
| 300 |
if (!empty($this->limit)) { |
| 301 |
$json['limit'] = $this->limit['value']; |
| 302 |
} |
| 303 |
if (!empty($this->cursor)) { |
| 304 |
$json['cursor'] = $this->cursor['value']; |
| 305 |
} |
| 306 |
if (!empty($this->customerId)) { |
| 307 |
$json['customer_id'] = $this->customerId['value']; |
| 308 |
} |
| 309 |
if (!empty($this->teamMemberId)) { |
| 310 |
$json['team_member_id'] = $this->teamMemberId['value']; |
| 311 |
} |
| 312 |
if (!empty($this->locationId)) { |
| 313 |
$json['location_id'] = $this->locationId['value']; |
| 314 |
} |
| 315 |
if (!empty($this->startAtMin)) { |
| 316 |
$json['start_at_min'] = $this->startAtMin['value']; |
| 317 |
} |
| 318 |
if (!empty($this->startAtMax)) { |
| 319 |
$json['start_at_max'] = $this->startAtMax['value']; |
| 320 |
} |
| 321 |
$json = array_filter($json, function ($val) { |
| 322 |
return $val !== null; |
| 323 |
}); |
| 324 |
|
| 325 |
return (!$asArrayWhenEmpty && empty($json)) ? new stdClass() : $json; |
| 326 |
} |
| 327 |
} |
| 328 |
|