commercetools-sdk-php-v2
The commercetools platform, import-api and PHP sdks generated from our api reference.
MessageModel.php
1 <?php
2 
3 declare(strict_types=1);
10 
23 use DateTimeImmutable;
24 use stdClass;
25 
29 final class MessageModel extends JsonObjectModel implements Message
30 {
31  public const DISCRIMINATOR_VALUE = '';
36  protected $id;
37 
42  protected $version;
43 
48  protected $createdAt;
49 
54  protected $lastModifiedAt;
55 
60  protected $lastModifiedBy;
61 
66  protected $createdBy;
67 
72  protected $sequenceNumber;
73 
78  protected $resource;
79 
84  protected $resourceVersion;
85 
90  protected $type;
91 
97 
102  private static $discriminatorClasses = [
103  'ApprovalFlowApproved' => ApprovalFlowApprovedMessageModel::class,
104  'ApprovalFlowCompleted' => ApprovalFlowCompletedMessageModel::class,
105  'ApprovalFlowCreated' => ApprovalFlowCreatedMessageModel::class,
106  'ApprovalFlowRejected' => ApprovalFlowRejectedMessageModel::class,
107  'ApprovalRuleApproversSet' => ApprovalRuleApproversSetMessageModel::class,
108  'ApprovalRuleCreated' => ApprovalRuleCreatedMessageModel::class,
109  'ApprovalRuleDescriptionSet' => ApprovalRuleDescriptionSetMessageModel::class,
110  'ApprovalRuleKeySet' => ApprovalRuleKeySetMessageModel::class,
111  'ApprovalRuleNameSet' => ApprovalRuleNameSetMessageModel::class,
112  'ApprovalRulePredicateSet' => ApprovalRulePredicateSetMessageModel::class,
113  'ApprovalRuleRequestersSet' => ApprovalRuleRequestersSetMessageModel::class,
114  'ApprovalRuleStatusSet' => ApprovalRuleStatusSetMessageModel::class,
115  'AssociateRoleBuyerAssignableChanged' => AssociateRoleBuyerAssignableChangedMessageModel::class,
116  'AssociateRoleCreated' => AssociateRoleCreatedMessageModel::class,
117  'AssociateRoleDeleted' => AssociateRoleDeletedMessageModel::class,
118  'AssociateRoleNameSet' => AssociateRoleNameChangedMessageModel::class,
119  'AssociateRolePermissionAdded' => AssociateRolePermissionAddedMessageModel::class,
120  'AssociateRolePermissionRemoved' => AssociateRolePermissionRemovedMessageModel::class,
121  'AssociateRolePermissionsSet' => AssociateRolePermissionsSetMessageModel::class,
122  'BusinessUnitAddressAdded' => BusinessUnitAddressAddedMessageModel::class,
123  'BusinessUnitAddressChanged' => BusinessUnitAddressChangedMessageModel::class,
124  'BusinessUnitAddressCustomFieldAdded' => BusinessUnitAddressCustomFieldAddedMessageModel::class,
125  'BusinessUnitAddressCustomFieldChanged' => BusinessUnitAddressCustomFieldChangedMessageModel::class,
126  'BusinessUnitAddressCustomFieldRemoved' => BusinessUnitAddressCustomFieldRemovedMessageModel::class,
127  'BusinessUnitAddressCustomTypeRemoved' => BusinessUnitAddressCustomTypeRemovedMessageModel::class,
128  'BusinessUnitAddressCustomTypeSet' => BusinessUnitAddressCustomTypeSetMessageModel::class,
129  'BusinessUnitAddressRemoved' => BusinessUnitAddressRemovedMessageModel::class,
130  'BusinessUnitApprovalRuleModeChanged' => BusinessUnitApprovalRuleModeChangedMessageModel::class,
131  'BusinessUnitAssociateAdded' => BusinessUnitAssociateAddedMessageModel::class,
132  'BusinessUnitAssociateChanged' => BusinessUnitAssociateChangedMessageModel::class,
133  'BusinessUnitAssociateModeChanged' => BusinessUnitAssociateModeChangedMessageModel::class,
134  'BusinessUnitAssociateRemoved' => BusinessUnitAssociateRemovedMessageModel::class,
135  'BusinessUnitAssociatesSet' => BusinessUnitAssociatesSetMessageModel::class,
136  'BusinessUnitBillingAddressAdded' => BusinessUnitBillingAddressAddedMessageModel::class,
137  'BusinessUnitBillingAddressRemoved' => BusinessUnitBillingAddressRemovedMessageModel::class,
138  'BusinessUnitContactEmailSet' => BusinessUnitContactEmailSetMessageModel::class,
139  'BusinessUnitCreated' => BusinessUnitCreatedMessageModel::class,
140  'BusinessUnitCustomFieldAdded' => BusinessUnitCustomFieldAddedMessageModel::class,
141  'BusinessUnitCustomFieldChanged' => BusinessUnitCustomFieldChangedMessageModel::class,
142  'BusinessUnitCustomFieldRemoved' => BusinessUnitCustomFieldRemovedMessageModel::class,
143  'BusinessUnitCustomTypeRemoved' => BusinessUnitCustomTypeRemovedMessageModel::class,
144  'BusinessUnitCustomTypeSet' => BusinessUnitCustomTypeSetMessageModel::class,
145  'BusinessUnitDefaultBillingAddressSet' => BusinessUnitDefaultBillingAddressSetMessageModel::class,
146  'BusinessUnitDefaultShippingAddressSet' => BusinessUnitDefaultShippingAddressSetMessageModel::class,
147  'BusinessUnitDeleted' => BusinessUnitDeletedMessageModel::class,
148  'BusinessUnitNameChanged' => BusinessUnitNameChangedMessageModel::class,
149  'BusinessUnitParentChanged' => BusinessUnitParentChangedMessageModel::class,
150  'BusinessUnitShippingAddressAdded' => BusinessUnitShippingAddressAddedMessageModel::class,
151  'BusinessUnitShippingAddressRemoved' => BusinessUnitShippingAddressRemovedMessageModel::class,
152  'BusinessUnitStatusChanged' => BusinessUnitStatusChangedMessageModel::class,
153  'BusinessUnitStoreAdded' => BusinessUnitStoreAddedMessageModel::class,
154  'BusinessUnitStoreModeChanged' => BusinessUnitStoreModeChangedMessageModel::class,
155  'BusinessUnitStoreRemoved' => BusinessUnitStoreRemovedMessageModel::class,
156  'BusinessUnitStoresSet' => BusinessUnitStoresSetMessageModel::class,
157  'CartDiscountCreated' => CartDiscountCreatedMessageModel::class,
158  'CartDiscountDeleted' => CartDiscountDeletedMessageModel::class,
159  'CartDiscountStoreAdded' => CartDiscountStoreAddedMessageModel::class,
160  'CartDiscountStoreRemoved' => CartDiscountStoreRemovedMessageModel::class,
161  'CartDiscountStoresSet' => CartDiscountStoresSetMessageModel::class,
162  'CategoryCreated' => CategoryCreatedMessageModel::class,
163  'CategorySlugChanged' => CategorySlugChangedMessageModel::class,
164  'CustomLineItemStateTransition' => CustomLineItemStateTransitionMessageModel::class,
165  'CustomerAddressAdded' => CustomerAddressAddedMessageModel::class,
166  'CustomerAddressChanged' => CustomerAddressChangedMessageModel::class,
167  'CustomerAddressCustomFieldAdded' => CustomerAddressCustomFieldAddedMessageModel::class,
168  'CustomerAddressCustomFieldChanged' => CustomerAddressCustomFieldChangedMessageModel::class,
169  'CustomerAddressCustomFieldRemoved' => CustomerAddressCustomFieldRemovedMessageModel::class,
170  'CustomerAddressCustomTypeRemoved' => CustomerAddressCustomTypeRemovedMessageModel::class,
171  'CustomerAddressCustomTypeSet' => CustomerAddressCustomTypeSetMessageModel::class,
172  'CustomerAddressRemoved' => CustomerAddressRemovedMessageModel::class,
173  'CustomerCompanyNameSet' => CustomerCompanyNameSetMessageModel::class,
174  'CustomerCreated' => CustomerCreatedMessageModel::class,
175  'CustomerCustomFieldAdded' => CustomerCustomFieldAddedMessageModel::class,
176  'CustomerCustomFieldChanged' => CustomerCustomFieldChangedMessageModel::class,
177  'CustomerCustomFieldRemoved' => CustomerCustomFieldRemovedMessageModel::class,
178  'CustomerCustomTypeRemoved' => CustomerCustomTypeRemovedMessageModel::class,
179  'CustomerCustomTypeSet' => CustomerCustomTypeSetMessageModel::class,
180  'CustomerDateOfBirthSet' => CustomerDateOfBirthSetMessageModel::class,
181  'CustomerDeleted' => CustomerDeletedMessageModel::class,
182  'CustomerEmailChanged' => CustomerEmailChangedMessageModel::class,
183  'CustomerEmailTokenCreated' => CustomerEmailTokenCreatedMessageModel::class,
184  'CustomerEmailVerified' => CustomerEmailVerifiedMessageModel::class,
185  'CustomerFirstNameSet' => CustomerFirstNameSetMessageModel::class,
186  'CustomerGroupCustomFieldAdded' => CustomerGroupCustomFieldAddedMessageModel::class,
187  'CustomerGroupCustomFieldChanged' => CustomerGroupCustomFieldChangedMessageModel::class,
188  'CustomerGroupCustomFieldRemoved' => CustomerGroupCustomFieldRemovedMessageModel::class,
189  'CustomerGroupCustomTypeRemoved' => CustomerGroupCustomTypeRemovedMessageModel::class,
190  'CustomerGroupCustomTypeSet' => CustomerGroupCustomTypeSetMessageModel::class,
191  'CustomerGroupSet' => CustomerGroupSetMessageModel::class,
192  'CustomerLastNameSet' => CustomerLastNameSetMessageModel::class,
193  'CustomerPasswordTokenCreated' => CustomerPasswordTokenCreatedMessageModel::class,
194  'CustomerPasswordUpdated' => CustomerPasswordUpdatedMessageModel::class,
195  'CustomerTitleSet' => CustomerTitleSetMessageModel::class,
196  'DeliveryAdded' => DeliveryAddedMessageModel::class,
197  'DeliveryAddressSet' => DeliveryAddressSetMessageModel::class,
198  'DeliveryCustomFieldAdded' => DeliveryCustomFieldAddedMessageModel::class,
199  'DeliveryCustomFieldChanged' => DeliveryCustomFieldChangedMessageModel::class,
200  'DeliveryCustomFieldRemoved' => DeliveryCustomFieldRemovedMessageModel::class,
201  'DeliveryCustomTypeRemoved' => DeliveryCustomTypeRemovedMessageModel::class,
202  'DeliveryCustomTypeSet' => DeliveryCustomTypeSetMessageModel::class,
203  'DeliveryItemsUpdated' => DeliveryItemsUpdatedMessageModel::class,
204  'DeliveryRemoved' => DeliveryRemovedMessageModel::class,
205  'DiscountCodeCreated' => DiscountCodeCreatedMessageModel::class,
206  'DiscountCodeDeleted' => DiscountCodeDeletedMessageModel::class,
207  'DiscountCodeKeySet' => DiscountCodeKeySetMessageModel::class,
208  'InventoryEntryCreated' => InventoryEntryCreatedMessageModel::class,
209  'InventoryEntryDeleted' => InventoryEntryDeletedMessageModel::class,
210  'InventoryEntryQuantitySet' => InventoryEntryQuantitySetMessageModel::class,
211  'LineItemStateTransition' => LineItemStateTransitionMessageModel::class,
212  'OrderBillingAddressSet' => OrderBillingAddressSetMessageModel::class,
213  'OrderCreated' => OrderCreatedMessageModel::class,
214  'OrderCustomFieldAdded' => OrderCustomFieldAddedMessageModel::class,
215  'OrderCustomFieldChanged' => OrderCustomFieldChangedMessageModel::class,
216  'OrderCustomFieldRemoved' => OrderCustomFieldRemovedMessageModel::class,
217  'OrderCustomLineItemAdded' => OrderCustomLineItemAddedMessageModel::class,
218  'OrderCustomLineItemDiscountSet' => OrderCustomLineItemDiscountSetMessageModel::class,
219  'OrderCustomLineItemQuantityChanged' => OrderCustomLineItemQuantityChangedMessageModel::class,
220  'OrderCustomLineItemRemoved' => OrderCustomLineItemRemovedMessageModel::class,
221  'OrderCustomTypeRemoved' => OrderCustomTypeRemovedMessageModel::class,
222  'OrderCustomTypeSet' => OrderCustomTypeSetMessageModel::class,
223  'OrderCustomerEmailSet' => OrderCustomerEmailSetMessageModel::class,
224  'OrderCustomerGroupSet' => OrderCustomerGroupSetMessageModel::class,
225  'OrderCustomerSet' => OrderCustomerSetMessageModel::class,
226  'OrderDeleted' => OrderDeletedMessageModel::class,
227  'OrderDiscountCodeAdded' => OrderDiscountCodeAddedMessageModel::class,
228  'OrderDiscountCodeRemoved' => OrderDiscountCodeRemovedMessageModel::class,
229  'OrderDiscountCodeStateSet' => OrderDiscountCodeStateSetMessageModel::class,
230  'OrderEditApplied' => OrderEditAppliedMessageModel::class,
231  'OrderImported' => OrderImportedMessageModel::class,
232  'OrderLineItemAdded' => OrderLineItemAddedMessageModel::class,
233  'OrderLineItemDiscountSet' => OrderLineItemDiscountSetMessageModel::class,
234  'OrderLineItemDistributionChannelSet' => OrderLineItemDistributionChannelSetMessageModel::class,
235  'OrderLineItemRemoved' => OrderLineItemRemovedMessageModel::class,
236  'OrderPaymentAdded' => OrderPaymentAddedMessageModel::class,
237  'OrderPaymentStateChanged' => OrderPaymentStateChangedMessageModel::class,
238  'OrderPurchaseOrderNumberSet' => OrderPurchaseOrderNumberSetMessageModel::class,
239  'OrderReturnShipmentStateChanged' => OrderReturnShipmentStateChangedMessageModel::class,
240  'OrderShipmentStateChanged' => OrderShipmentStateChangedMessageModel::class,
241  'OrderShippingAddressSet' => OrderShippingAddressSetMessageModel::class,
242  'OrderShippingInfoSet' => OrderShippingInfoSetMessageModel::class,
243  'OrderShippingRateInputSet' => OrderShippingRateInputSetMessageModel::class,
244  'OrderStateChanged' => OrderStateChangedMessageModel::class,
245  'OrderStateTransition' => OrderStateTransitionMessageModel::class,
246  'OrderStoreSet' => OrderStoreSetMessageModel::class,
247  'ParcelAddedToDelivery' => ParcelAddedToDeliveryMessageModel::class,
248  'ParcelItemsUpdated' => ParcelItemsUpdatedMessageModel::class,
249  'ParcelMeasurementsUpdated' => ParcelMeasurementsUpdatedMessageModel::class,
250  'ParcelRemovedFromDelivery' => ParcelRemovedFromDeliveryMessageModel::class,
251  'ParcelTrackingDataUpdated' => ParcelTrackingDataUpdatedMessageModel::class,
252  'PaymentCreated' => PaymentCreatedMessageModel::class,
253  'PaymentInteractionAdded' => PaymentInteractionAddedMessageModel::class,
254  'PaymentStatusInterfaceCodeSet' => PaymentStatusInterfaceCodeSetMessageModel::class,
255  'PaymentStatusStateTransition' => PaymentStatusStateTransitionMessageModel::class,
256  'PaymentTransactionAdded' => PaymentTransactionAddedMessageModel::class,
257  'PaymentTransactionStateChanged' => PaymentTransactionStateChangedMessageModel::class,
258  'ProductAddedToCategory' => ProductAddedToCategoryMessageModel::class,
259  'ProductCreated' => ProductCreatedMessageModel::class,
260  'ProductDeleted' => ProductDeletedMessageModel::class,
261  'ProductImageAdded' => ProductImageAddedMessageModel::class,
262  'ProductPriceAdded' => ProductPriceAddedMessageModel::class,
263  'ProductPriceChanged' => ProductPriceChangedMessageModel::class,
264  'ProductPriceCustomFieldAdded' => ProductPriceCustomFieldAddedMessageModel::class,
265  'ProductPriceCustomFieldChanged' => ProductPriceCustomFieldChangedMessageModel::class,
266  'ProductPriceCustomFieldRemoved' => ProductPriceCustomFieldRemovedMessageModel::class,
267  'ProductPriceCustomFieldsRemoved' => ProductPriceCustomFieldsRemovedMessageModel::class,
268  'ProductPriceCustomFieldsSet' => ProductPriceCustomFieldsSetMessageModel::class,
269  'ProductPriceDiscountsSet' => ProductPriceDiscountsSetMessageModel::class,
270  'ProductPriceExternalDiscountSet' => ProductPriceExternalDiscountSetMessageModel::class,
271  'ProductPriceKeySet' => ProductPriceKeySetMessageModel::class,
272  'ProductPriceModeSet' => ProductPriceModeSetMessageModel::class,
273  'ProductPriceRemoved' => ProductPriceRemovedMessageModel::class,
274  'ProductPricesSet' => ProductPricesSetMessageModel::class,
275  'ProductPublished' => ProductPublishedMessageModel::class,
276  'ProductRemovedFromCategory' => ProductRemovedFromCategoryMessageModel::class,
277  'ProductRevertedStagedChanges' => ProductRevertedStagedChangesMessageModel::class,
278  'ProductSelectionCreated' => ProductSelectionCreatedMessageModel::class,
279  'ProductSelectionDeleted' => ProductSelectionDeletedMessageModel::class,
280  'ProductSelectionProductAdded' => ProductSelectionProductAddedMessageModel::class,
281  'ProductSelectionProductExcluded' => ProductSelectionProductExcludedMessageModel::class,
282  'ProductSelectionProductRemoved' => ProductSelectionProductRemovedMessageModel::class,
283  'ProductSelectionVariantExclusionChanged' => ProductSelectionVariantExclusionChangedMessageModel::class,
284  'ProductSelectionVariantSelectionChanged' => ProductSelectionVariantSelectionChangedMessageModel::class,
285  'ProductSlugChanged' => ProductSlugChangedMessageModel::class,
286  'ProductStateTransition' => ProductStateTransitionMessageModel::class,
287  'ProductTailoringCreated' => ProductTailoringCreatedMessageModel::class,
288  'ProductTailoringDeleted' => ProductTailoringDeletedMessageModel::class,
289  'ProductTailoringDescriptionSet' => ProductTailoringDescriptionSetMessageModel::class,
290  'ProductTailoringImageAdded' => ProductTailoringImageAddedMessageModel::class,
291  'ProductTailoringImagesSet' => ProductTailoringImagesSetMessageModel::class,
292  'ProductTailoringNameSet' => ProductTailoringNameSetMessageModel::class,
293  'ProductTailoringPublished' => ProductTailoringPublishedMessageModel::class,
294  'ProductTailoringSlugSet' => ProductTailoringSlugSetMessageModel::class,
295  'ProductTailoringUnpublished' => ProductTailoringUnpublishedMessageModel::class,
296  'ProductUnpublished' => ProductUnpublishedMessageModel::class,
297  'ProductVariantAdded' => ProductVariantAddedMessageModel::class,
298  'ProductVariantDeleted' => ProductVariantDeletedMessageModel::class,
299  'ProductVariantTailoringAdded' => ProductVariantTailoringAddedMessageModel::class,
300  'ProductVariantTailoringRemoved' => ProductVariantTailoringRemovedMessageModel::class,
301  'QuoteCreated' => QuoteCreatedMessageModel::class,
302  'QuoteCustomerChanged' => QuoteCustomerChangedMessageModel::class,
303  'QuoteDeleted' => QuoteDeletedMessageModel::class,
304  'QuoteRenegotiationRequested' => QuoteRenegotiationRequestedMessageModel::class,
305  'QuoteRequestCreated' => QuoteRequestCreatedMessageModel::class,
306  'QuoteRequestCustomerChanged' => QuoteRequestCustomerChangedMessageModel::class,
307  'QuoteRequestDeleted' => QuoteRequestDeletedMessageModel::class,
308  'QuoteRequestStateChanged' => QuoteRequestStateChangedMessageModel::class,
309  'QuoteRequestStateTransition' => QuoteRequestStateTransitionMessageModel::class,
310  'QuoteStateChanged' => QuoteStateChangedMessageModel::class,
311  'QuoteStateTransition' => QuoteStateTransitionMessageModel::class,
312  'ReturnInfoAdded' => ReturnInfoAddedMessageModel::class,
313  'ReturnInfoSet' => ReturnInfoSetMessageModel::class,
314  'ReviewCreated' => ReviewCreatedMessageModel::class,
315  'ReviewRatingSet' => ReviewRatingSetMessageModel::class,
316  'ReviewStateTransition' => ReviewStateTransitionMessageModel::class,
317  'StagedQuoteCreated' => StagedQuoteCreatedMessageModel::class,
318  'StagedQuoteDeleted' => StagedQuoteDeletedMessageModel::class,
319  'StagedQuoteSellerCommentSet' => StagedQuoteSellerCommentSetMessageModel::class,
320  'StagedQuoteStateChanged' => StagedQuoteStateChangedMessageModel::class,
321  'StagedQuoteStateTransition' => StagedQuoteStateTransitionMessageModel::class,
322  'StagedQuoteValidToSet' => StagedQuoteValidToSetMessageModel::class,
323  'StandalonePriceActiveChanged' => StandalonePriceActiveChangedMessageModel::class,
324  'StandalonePriceCreated' => StandalonePriceCreatedMessageModel::class,
325  'StandalonePriceDeleted' => StandalonePriceDeletedMessageModel::class,
326  'StandalonePriceDiscountSet' => StandalonePriceDiscountSetMessageModel::class,
327  'StandalonePriceExternalDiscountSet' => StandalonePriceExternalDiscountSetMessageModel::class,
328  'StandalonePriceKeySet' => StandalonePriceKeySetMessageModel::class,
329  'StandalonePriceStagedChangesApplied' => StandalonePriceStagedChangesAppliedMessageModel::class,
330  'StandalonePriceStagedChangesRemoved' => StandalonePriceStagedChangesRemovedMessageModel::class,
331  'StandalonePriceTierAdded' => StandalonePriceTierAddedMessageModel::class,
332  'StandalonePriceTierRemoved' => StandalonePriceTierRemovedMessageModel::class,
333  'StandalonePriceTiersSet' => StandalonePriceTiersSetMessageModel::class,
334  'StandalonePriceValidFromAndUntilSet' => StandalonePriceValidFromAndUntilSetMessageModel::class,
335  'StandalonePriceValidFromSet' => StandalonePriceValidFromSetMessageModel::class,
336  'StandalonePriceValidUntilSet' => StandalonePriceValidUntilSetMessageModel::class,
337  'StandalonePriceValueChanged' => StandalonePriceValueChangedMessageModel::class,
338  'StoreCountriesChanged' => StoreCountriesChangedMessageModel::class,
339  'StoreCreated' => StoreCreatedMessageModel::class,
340  'StoreDeleted' => StoreDeletedMessageModel::class,
341  'StoreDistributionChannelsChanged' => StoreDistributionChannelsChangedMessageModel::class,
342  'StoreLanguagesChanged' => StoreLanguagesChangedMessageModel::class,
343  'StoreNameSet' => StoreNameSetMessageModel::class,
344  'StoreProductSelectionsChanged' => StoreProductSelectionsChangedMessageModel::class,
345  'StoreSupplyChannelsChanged' => StoreSupplyChannelsChangedMessageModel::class,
346  ];
347 
351  public function __construct(
352  ?string $id = null,
353  ?int $version = null,
354  ?DateTimeImmutable $createdAt = null,
355  ?DateTimeImmutable $lastModifiedAt = null,
357  ?CreatedBy $createdBy = null,
358  ?int $sequenceNumber = null,
359  ?Reference $resource = null,
360  ?int $resourceVersion = null,
362  ?string $type = null
363  ) {
364  $this->id = $id;
365  $this->version = $version;
366  $this->createdAt = $createdAt;
367  $this->lastModifiedAt = $lastModifiedAt;
368  $this->lastModifiedBy = $lastModifiedBy;
369  $this->createdBy = $createdBy;
370  $this->sequenceNumber = $sequenceNumber;
371  $this->resource = $resource;
372  $this->resourceVersion = $resourceVersion;
373  $this->resourceUserProvidedIdentifiers = $resourceUserProvidedIdentifiers;
374  $this->type = $type;
375  }
376 
383  public function getId()
384  {
385  if (is_null($this->id)) {
387  $data = $this->raw(self::FIELD_ID);
388  if (is_null($data)) {
389  return null;
390  }
391  $this->id = (string) $data;
392  }
393 
394  return $this->id;
395  }
396 
403  public function getVersion()
404  {
405  if (is_null($this->version)) {
407  $data = $this->raw(self::FIELD_VERSION);
408  if (is_null($data)) {
409  return null;
410  }
411  $this->version = (int) $data;
412  }
413 
414  return $this->version;
415  }
416 
423  public function getCreatedAt()
424  {
425  if (is_null($this->createdAt)) {
427  $data = $this->raw(self::FIELD_CREATED_AT);
428  if (is_null($data)) {
429  return null;
430  }
431  $data = DateTimeImmutable::createFromFormat(MapperFactory::DATETIME_FORMAT, $data);
432  if (false === $data) {
433  return null;
434  }
435  $this->createdAt = $data;
436  }
437 
438  return $this->createdAt;
439  }
440 
447  public function getLastModifiedAt()
448  {
449  if (is_null($this->lastModifiedAt)) {
451  $data = $this->raw(self::FIELD_LAST_MODIFIED_AT);
452  if (is_null($data)) {
453  return null;
454  }
455  $data = DateTimeImmutable::createFromFormat(MapperFactory::DATETIME_FORMAT, $data);
456  if (false === $data) {
457  return null;
458  }
459  $this->lastModifiedAt = $data;
460  }
461 
462  return $this->lastModifiedAt;
463  }
464 
471  public function getLastModifiedBy()
472  {
473  if (is_null($this->lastModifiedBy)) {
475  $data = $this->raw(self::FIELD_LAST_MODIFIED_BY);
476  if (is_null($data)) {
477  return null;
478  }
479 
480  $this->lastModifiedBy = LastModifiedByModel::of($data);
481  }
482 
483  return $this->lastModifiedBy;
484  }
485 
492  public function getCreatedBy()
493  {
494  if (is_null($this->createdBy)) {
496  $data = $this->raw(self::FIELD_CREATED_BY);
497  if (is_null($data)) {
498  return null;
499  }
500 
501  $this->createdBy = CreatedByModel::of($data);
502  }
503 
504  return $this->createdBy;
505  }
506 
514  public function getSequenceNumber()
515  {
516  if (is_null($this->sequenceNumber)) {
518  $data = $this->raw(self::FIELD_SEQUENCE_NUMBER);
519  if (is_null($data)) {
520  return null;
521  }
522  $this->sequenceNumber = (int) $data;
523  }
524 
525  return $this->sequenceNumber;
526  }
527 
534  public function getResource()
535  {
536  if (is_null($this->resource)) {
538  $data = $this->raw(self::FIELD_RESOURCE);
539  if (is_null($data)) {
540  return null;
541  }
542  $className = ReferenceModel::resolveDiscriminatorClass($data);
543  $this->resource = $className::of($data);
544  }
545 
546  return $this->resource;
547  }
548 
555  public function getResourceVersion()
556  {
557  if (is_null($this->resourceVersion)) {
559  $data = $this->raw(self::FIELD_RESOURCE_VERSION);
560  if (is_null($data)) {
561  return null;
562  }
563  $this->resourceVersion = (int) $data;
564  }
565 
566  return $this->resourceVersion;
567  }
568 
575  public function getType()
576  {
577  if (is_null($this->type)) {
579  $data = $this->raw(self::FIELD_TYPE);
580  if (is_null($data)) {
581  return null;
582  }
583  $this->type = (string) $data;
584  }
585 
586  return $this->type;
587  }
588 
596  {
597  if (is_null($this->resourceUserProvidedIdentifiers)) {
599  $data = $this->raw(self::FIELD_RESOURCE_USER_PROVIDED_IDENTIFIERS);
600  if (is_null($data)) {
601  return null;
602  }
603 
604  $this->resourceUserProvidedIdentifiers = UserProvidedIdentifiersModel::of($data);
605  }
606 
608  }
609 
610 
614  public function setId(?string $id): void
615  {
616  $this->id = $id;
617  }
618 
622  public function setVersion(?int $version): void
623  {
624  $this->version = $version;
625  }
626 
630  public function setCreatedAt(?DateTimeImmutable $createdAt): void
631  {
632  $this->createdAt = $createdAt;
633  }
634 
638  public function setLastModifiedAt(?DateTimeImmutable $lastModifiedAt): void
639  {
640  $this->lastModifiedAt = $lastModifiedAt;
641  }
642 
647  {
648  $this->lastModifiedBy = $lastModifiedBy;
649  }
650 
654  public function setCreatedBy(?CreatedBy $createdBy): void
655  {
656  $this->createdBy = $createdBy;
657  }
658 
662  public function setSequenceNumber(?int $sequenceNumber): void
663  {
664  $this->sequenceNumber = $sequenceNumber;
665  }
666 
670  public function setResource(?Reference $resource): void
671  {
672  $this->resource = $resource;
673  }
674 
678  public function setResourceVersion(?int $resourceVersion): void
679  {
680  $this->resourceVersion = $resourceVersion;
681  }
682 
687  {
688  $this->resourceUserProvidedIdentifiers = $resourceUserProvidedIdentifiers;
689  }
690 
691 
692  #[\ReturnTypeWillChange]
693  public function jsonSerialize()
694  {
695  $data = $this->toArray();
696  if (isset($data[Message::FIELD_CREATED_AT]) && $data[Message::FIELD_CREATED_AT] instanceof \DateTimeImmutable) {
697  $data[Message::FIELD_CREATED_AT] = $data[Message::FIELD_CREATED_AT]->setTimeZone(new \DateTimeZone('UTC'))->format('c');
698  }
699 
700  if (isset($data[Message::FIELD_LAST_MODIFIED_AT]) && $data[Message::FIELD_LAST_MODIFIED_AT] instanceof \DateTimeImmutable) {
701  $data[Message::FIELD_LAST_MODIFIED_AT] = $data[Message::FIELD_LAST_MODIFIED_AT]->setTimeZone(new \DateTimeZone('UTC'))->format('c');
702  }
703  return (object) $data;
704  }
705 
710  public static function resolveDiscriminatorClass($value): string
711  {
712  $fieldName = Message::DISCRIMINATOR_FIELD;
713  if (is_object($value) && isset($value->$fieldName)) {
715  $discriminatorValue = $value->$fieldName;
716  if (isset(self::$discriminatorClasses[$discriminatorValue])) {
717  return self::$discriminatorClasses[$discriminatorValue];
718  }
719  }
720  if (is_array($value) && isset($value[$fieldName])) {
722  $discriminatorValue = $value[$fieldName];
723  if (isset(self::$discriminatorClasses[$discriminatorValue])) {
724  return self::$discriminatorClasses[$discriminatorValue];
725  }
726  }
727 
729  $type = MessageModel::class;
730  return $type;
731  }
732 }
__construct(?string $id=null, ?int $version=null, ?DateTimeImmutable $createdAt=null, ?DateTimeImmutable $lastModifiedAt=null, ?LastModifiedBy $lastModifiedBy=null, ?CreatedBy $createdBy=null, ?int $sequenceNumber=null, ?Reference $resource=null, ?int $resourceVersion=null, ?UserProvidedIdentifiers $resourceUserProvidedIdentifiers=null, ?string $type=null)
setCreatedAt(?DateTimeImmutable $createdAt)
setLastModifiedAt(?DateTimeImmutable $lastModifiedAt)
setResourceUserProvidedIdentifiers(?UserProvidedIdentifiers $resourceUserProvidedIdentifiers)
setLastModifiedBy(?LastModifiedBy $lastModifiedBy)