Completed
Pull Request — master (#322)
by Luc
04:11
created

Offer::updateCalendar()   A

Complexity

Conditions 1
Paths 1

Size

Total Lines 7
Code Lines 3

Duplication

Lines 0
Ratio 0 %

Importance

Changes 0
Metric Value
dl 0
loc 7
rs 9.4285
c 0
b 0
f 0
cc 1
eloc 3
nc 1
nop 1
1
<?php
2
3
namespace CultuurNet\UDB3\Offer;
4
5
use Broadway\EventSourcing\EventSourcedAggregateRoot;
6
use CultureFeed_Cdb_Item_Base;
7
use CultuurNet\UDB3\BookingInfo;
8
use CultuurNet\UDB3\Calendar;
9
use CultuurNet\UDB3\ContactPoint;
10
use CultuurNet\UDB3\Description;
11
use CultuurNet\UDB3\Label;
12
use CultuurNet\UDB3\LabelAwareAggregateRoot;
13
use CultuurNet\UDB3\LabelCollection;
14
use CultuurNet\UDB3\Media\Image;
15
use CultuurNet\UDB3\Media\ImageCollection;
16
use CultuurNet\UDB3\Offer\Commands\Image\AbstractUpdateImage;
17
use CultuurNet\UDB3\Language;
18
use CultuurNet\UDB3\Offer\Events\AbstractBookingInfoUpdated;
19
use CultuurNet\UDB3\Offer\Events\AbstractContactPointUpdated;
20
use CultuurNet\UDB3\Offer\Events\AbstractDescriptionTranslated;
21
use CultuurNet\UDB3\Offer\Events\AbstractDescriptionUpdated;
22
use CultuurNet\UDB3\Offer\Events\AbstractLabelAdded;
23
use CultuurNet\UDB3\Offer\Events\AbstractLabelRemoved;
24
use CultuurNet\UDB3\Offer\Events\AbstractOfferDeleted;
25
use CultuurNet\UDB3\Offer\Events\AbstractOrganizerDeleted;
26
use CultuurNet\UDB3\Offer\Events\AbstractOrganizerUpdated;
27
use CultuurNet\UDB3\Offer\Events\AbstractPriceInfoUpdated;
28
use CultuurNet\UDB3\Offer\Events\AbstractTypicalAgeRangeDeleted;
29
use CultuurNet\UDB3\Offer\Events\AbstractTypicalAgeRangeUpdated;
30
use CultuurNet\UDB3\Offer\Events\Image\AbstractImageAdded;
31
use CultuurNet\UDB3\Offer\Events\Image\AbstractImageRemoved;
32
use CultuurNet\UDB3\Offer\Events\Image\AbstractImagesEvent;
33
use CultuurNet\UDB3\Offer\Events\Image\AbstractImagesImportedFromUDB2;
34
use CultuurNet\UDB3\Offer\Events\Image\AbstractImagesUpdatedFromUDB2;
35
use CultuurNet\UDB3\Offer\Events\Image\AbstractImageUpdated;
36
use CultuurNet\UDB3\Offer\Events\Image\AbstractMainImageSelected;
37
use CultuurNet\UDB3\Offer\Events\AbstractTitleTranslated;
38
use CultuurNet\UDB3\Offer\Events\Moderation\AbstractApproved;
39
use CultuurNet\UDB3\Offer\Events\Moderation\AbstractFlaggedAsDuplicate;
40
use CultuurNet\UDB3\Offer\Events\Moderation\AbstractFlaggedAsInappropriate;
41
use CultuurNet\UDB3\Offer\Events\Moderation\AbstractPublished;
42
use CultuurNet\UDB3\Offer\Events\Moderation\AbstractRejected;
43
use CultuurNet\UDB3\PriceInfo\PriceInfo;
44
use Exception;
45
use ValueObjects\Identity\UUID;
46
use ValueObjects\StringLiteral\StringLiteral;
47
48
abstract class Offer extends EventSourcedAggregateRoot implements LabelAwareAggregateRoot
49
{
50
    const DUPLICATE_REASON = 'duplicate';
51
    const INAPPROPRIATE_REASON = 'inappropriate';
52
53
    /**
54
     * @var LabelCollection
55
     */
56
    protected $labels;
57
58
    /**
59
     * @var ImageCollection
60
     */
61
    protected $images;
62
63
    /**
64
     * @var string
65
     *
66
     * Organizer ids can come from UDB2 which does not strictly use UUIDs.
67
     */
68
    protected $organizerId;
69
70
    /**
71
     * @var WorkflowStatus
72
     */
73
    protected $workflowStatus;
74
75
    /**
76
     * @var StringLiteral|null
77
     */
78
    protected $rejectedReason;
79
80
    /**
81
     * @var PriceInfo
82
     */
83
    protected $priceInfo;
84
85
    /**
86
     * @var Description[]
87
     */
88
    protected $descriptions;
89
90
    /**
91
     * @var Language
92
     */
93
    protected $mainLanguage;
94
95
    /**
96
     * Offer constructor.
97
     */
98
    public function __construct()
99
    {
100
        // For now the main language is hard coded on nl.
101
        // In the future it should be set on create.
102
        $this->mainLanguage = new Language('nl');
103
104
        $this->descriptions = [];
105
        $this->labels = new LabelCollection();
106
        $this->images = new ImageCollection();
107
    }
108
109
    /**
110
     * Get the id of the main image if one is selected for this offer.
111
     *
112
     * @return UUID|null
113
     */
114
    protected function getMainImageId()
115
    {
116
        $mainImage = $this->images->getMain();
117
        return isset($mainImage) ? $mainImage->getMediaObjectId() : null;
118
    }
119
120
    /**
121
     * @inheritdoc
122
     */
123
    public function addLabel(Label $label)
124
    {
125
        if (!$this->labels->contains($label)) {
126
            $this->apply(
127
                $this->createLabelAddedEvent($label)
128
            );
129
        }
130
    }
131
132
    /**
133
     * @inheritdoc
134
     */
135
    public function removeLabel(Label $label)
136
    {
137
        if ($this->labels->contains($label)) {
138
            $this->apply(
139
                $this->createLabelRemovedEvent($label)
140
            );
141
        }
142
    }
143
144
    /**
145
     * @param Language $language
146
     * @param StringLiteral $title
147
     */
148
    public function translateTitle(Language $language, StringLiteral $title)
149
    {
150
        $this->apply(
151
            $this->createTitleTranslatedEvent($language, $title)
152
        );
153
    }
154
155
    /**
156
     * @param Description $description
157
     * @param Language $language
158
     */
159
    public function updateDescription(Description $description, Language $language)
160
    {
161
        if ($this->isDescriptionChanged($description, $language)) {
162
            if ($language->getCode() !== $this->mainLanguage->getCode()) {
163
                $event = $this->createDescriptionTranslatedEvent($language, $description);
164
            } else {
165
                $event = $this->createDescriptionUpdatedEvent((string) $description);
166
            }
167
168
            $this->apply($event);
169
        }
170
    }
171
172
    /**
173
     * @param Calendar $calendar
174
     */
175
    public function updateCalendar(Calendar $calendar)
176
    {
177
        // For now no special business rules for updating the calendar.
178
        $this->apply(
179
            $this->createCalendarUpdatedEvent($calendar)
180
        );
181
    }
182
183
    /**
184
     * @param string $typicalAgeRange
185
     */
186
    public function updateTypicalAgeRange($typicalAgeRange)
187
    {
188
        $this->apply(
189
            $this->createTypicalAgeRangeUpdatedEvent($typicalAgeRange)
190
        );
191
    }
192
193
    public function deleteTypicalAgeRange()
194
    {
195
        $this->apply(
196
            $this->createTypicalAgeRangeDeletedEvent()
197
        );
198
    }
199
200
    /**
201
     * @param string $organizerId
202
     */
203
    public function updateOrganizer($organizerId)
204
    {
205
        if ($this->organizerId !== $organizerId) {
206
            $this->apply(
207
                $this->createOrganizerUpdatedEvent($organizerId)
208
            );
209
        }
210
    }
211
212
    /**
213
     * Delete the given organizer.
214
     *
215
     * @param string $organizerId
216
     */
217
    public function deleteOrganizer($organizerId)
218
    {
219
        if ($this->organizerId === $organizerId) {
220
            $this->apply(
221
                $this->createOrganizerDeletedEvent($organizerId)
222
            );
223
        }
224
    }
225
226
    /**
227
     * Updated the contact info.
228
     * @param ContactPoint $contactPoint
229
     */
230
    public function updateContactPoint(ContactPoint $contactPoint)
231
    {
232
        $this->apply(
233
            $this->createContactPointUpdatedEvent($contactPoint)
234
        );
235
    }
236
237
    /**
238
     * Updated the booking info.
239
     *
240
     * @param BookingInfo $bookingInfo
241
     */
242
    public function updateBookingInfo(BookingInfo $bookingInfo)
243
    {
244
        $this->apply(
245
            $this->createBookingInfoUpdatedEvent($bookingInfo)
246
        );
247
    }
248
249
    /**
250
     * @param PriceInfo $priceInfo
251
     */
252
    public function updatePriceInfo(PriceInfo $priceInfo)
253
    {
254
        if (is_null($this->priceInfo) || $priceInfo->serialize() !== $this->priceInfo->serialize()) {
255
            $this->apply(
256
                $this->createPriceInfoUpdatedEvent($priceInfo)
257
            );
258
        }
259
    }
260
261
    /**
262
     * @param AbstractPriceInfoUpdated $priceInfoUpdated
263
     */
264
    protected function applyPriceInfoUpdated(AbstractPriceInfoUpdated $priceInfoUpdated)
265
    {
266
        $this->priceInfo = $priceInfoUpdated->getPriceInfo();
267
    }
268
269
    /**
270
     * @param AbstractLabelAdded $labelAdded
271
     */
272
    protected function applyLabelAdded(AbstractLabelAdded $labelAdded)
273
    {
274
        $this->labels = $this->labels->with($labelAdded->getLabel());
275
    }
276
277
    /**
278
     * @param AbstractLabelRemoved $labelRemoved
279
     */
280
    protected function applyLabelRemoved(AbstractLabelRemoved $labelRemoved)
281
    {
282
        $this->labels = $this->labels->without($labelRemoved->getLabel());
283
    }
284
285
    protected function applyDescriptionUpdated(AbstractDescriptionUpdated $descriptionUpdated)
286
    {
287
        $mainLanguageCode = $this->mainLanguage->getCode();
288
        $this->descriptions[$mainLanguageCode] = new Description($descriptionUpdated->getDescription());
289
    }
290
291
    protected function applyDescriptionTranslated(AbstractDescriptionTranslated $descriptionTranslated)
292
    {
293
        $languageCode = $descriptionTranslated->getLanguage()->getCode();
294
        $this->descriptions[$languageCode] = $descriptionTranslated->getDescription();
295
    }
296
297
    /**
298
     * Add a new image.
299
     *
300
     * @param Image $image
301
     */
302
    public function addImage(Image $image)
303
    {
304
        if (!$this->images->contains($image)) {
305
            $this->apply(
306
                $this->createImageAddedEvent($image)
307
            );
308
        }
309
    }
310
311
    /**
312
     * @param AbstractUpdateImage $updateImageCommand
313
     */
314
    public function updateImage(AbstractUpdateImage $updateImageCommand)
315
    {
316
        if ($this->images->findImageByUUID($updateImageCommand->getMediaObjectId())) {
317
            $this->apply(
318
                $this->createImageUpdatedEvent($updateImageCommand)
319
            );
320
        }
321
    }
322
323
    /**
324
     * Remove an image.
325
     *
326
     * @param Image $image
327
     */
328
    public function removeImage(Image $image)
329
    {
330
        if ($this->images->contains($image)) {
331
            $this->apply(
332
                $this->createImageRemovedEvent($image)
333
            );
334
        }
335
    }
336
337
    /**
338
     * Make an existing image of the item the main image.
339
     *
340
     * @param Image $image
341
     */
342
    public function selectMainImage(Image $image)
343
    {
344
        if (!$this->images->contains($image)) {
345
            throw new \InvalidArgumentException('You can not select a random image to be main, it has to be added to the item.');
346
        }
347
348
        $oldMainImage = $this->images->getMain();
349
350
        if (!isset($oldMainImage) || $oldMainImage->getMediaObjectId() !== $image->getMediaObjectId()) {
351
            $this->apply(
352
                $this->createMainImageSelectedEvent($image)
353
            );
354
        }
355
    }
356
357
    /**
358
     * Delete the offer.
359
     */
360
    public function delete()
361
    {
362
        $this->apply(
363
            $this->createOfferDeletedEvent()
364
        );
365
    }
366
367
    /**
368
     * @param CultureFeed_Cdb_Item_Base $cdbItem
369
     */
370
    protected function importWorkflowStatus(CultureFeed_Cdb_Item_Base $cdbItem)
371
    {
372
        try {
373
            $workflowStatus = WorkflowStatus::fromNative($cdbItem->getWfStatus());
374
        } catch (\InvalidArgumentException $exception) {
375
            $workflowStatus = WorkflowStatus::READY_FOR_VALIDATION();
376
        }
377
        $this->workflowStatus = $workflowStatus;
378
    }
379
380
    /**
381
     * Publish the offer when it has workflowstatus draft.
382
     * @param \DateTimeInterface $publicationDate
383
     */
384
    public function publish(\DateTimeInterface $publicationDate)
385
    {
386
        $this->guardPublish() ?: $this->apply(
387
            $this->createPublishedEvent($publicationDate)
388
        );
389
    }
390
391
    /**
392
     * @return bool
393
     * @throws Exception
394
     */
395 View Code Duplication
    private function guardPublish()
0 ignored issues
show
Duplication introduced by
This method seems to be duplicated in your project.

Duplicated code is one of the most pungent code smells. If you need to duplicate the same code in three or more different places, we strongly encourage you to look into extracting the code into a single class or operation.

You can also find more detailed suggestions in the “Code” section of your repository.

Loading history...
396
    {
397
        if ($this->workflowStatus === WorkflowStatus::READY_FOR_VALIDATION()) {
398
            return true; // nothing left to do if the offer has already been published
399
        }
400
401
        if ($this->workflowStatus !== WorkflowStatus::DRAFT()) {
402
            throw new Exception('You can not publish an offer that is not draft');
403
        }
404
405
        return false;
406
    }
407
408
    /**
409
     * Approve the offer when it's waiting for validation.
410
     */
411
    public function approve()
412
    {
413
        $this->guardApprove() ?: $this->apply($this->createApprovedEvent());
414
    }
415
416
    /**
417
     * @return bool
418
     * @throws Exception
419
     */
420 View Code Duplication
    private function guardApprove()
0 ignored issues
show
Duplication introduced by
This method seems to be duplicated in your project.

Duplicated code is one of the most pungent code smells. If you need to duplicate the same code in three or more different places, we strongly encourage you to look into extracting the code into a single class or operation.

You can also find more detailed suggestions in the “Code” section of your repository.

Loading history...
421
    {
422
        if ($this->workflowStatus === WorkflowStatus::APPROVED()) {
423
            return true; // nothing left to do if the offer has already been approved
424
        }
425
426
        if ($this->workflowStatus !== WorkflowStatus::READY_FOR_VALIDATION()) {
427
            throw new Exception('You can not approve an offer that is not ready for validation');
428
        }
429
430
        return false;
431
    }
432
433
    /**
434
     * Reject an offer that is waiting for validation with a given reason.
435
     * @param StringLiteral $reason
436
     */
437
    public function reject(StringLiteral $reason)
438
    {
439
        $this->guardRejection($reason) ?: $this->apply($this->createRejectedEvent($reason));
440
    }
441
442
    public function flagAsDuplicate()
443
    {
444
        $reason = new StringLiteral(self::DUPLICATE_REASON);
445
        $this->guardRejection($reason) ?: $this->apply($this->createFlaggedAsDuplicate());
446
    }
447
448
    public function flagAsInappropriate()
449
    {
450
        $reason = new StringLiteral(self::INAPPROPRIATE_REASON);
451
        $this->guardRejection($reason) ?: $this->apply($this->createFlaggedAsInappropriate());
452
    }
453
454
    /**
455
     * @param StringLiteral $reason
456
     * @return bool
457
     *  false when the offer can still be rejected, true when the offer is already rejected for the same reason
458
     * @throws Exception
459
     */
460
    private function guardRejection(StringLiteral $reason)
461
    {
462
        if ($this->workflowStatus === WorkflowStatus::REJECTED()) {
463
            if ($this->rejectedReason && $reason->sameValueAs($this->rejectedReason)) {
464
                return true; // nothing left to do if the offer has already been rejected for the same reason
465
            } else {
466
                throw new Exception('The offer has already been rejected for another reason: ' . $this->rejectedReason);
467
            }
468
        }
469
470
        if ($this->workflowStatus !== WorkflowStatus::READY_FOR_VALIDATION()) {
471
            throw new Exception('You can not reject an offer that is not ready for validation');
472
        }
473
474
        return false;
475
    }
476
477
    /**
478
     * @param Description $description
479
     * @param Language $language
480
     * @return bool
481
     */
482
    private function isDescriptionChanged(Description $description, Language $language)
483
    {
484
        $languageCode = $language->getCode();
485
486
        return !isset($this->descriptions[$languageCode]) ||
487
            !$description->sameValueAs($this->descriptions[$languageCode]);
488
    }
489
490
    /**
491
     * Overwrites or resets the main image and all media objects
492
     * by importing a new collection of images from UDB2.
493
     *
494
     * @param ImageCollection $images
495
     */
496
    public function importImagesFromUDB2(ImageCollection $images)
497
    {
498
        $this->apply($this->createImagesImportedFromUDB2($images));
499
    }
500
501
    /**
502
     * Overwrites or resets the main image and all media objects
503
     * by updating with a new collection of images from UDB2.
504
     *
505
     * @param ImageCollection $images
506
     */
507
    public function updateImagesFromUDB2(ImageCollection $images)
508
    {
509
        $this->apply($this->createImagesUpdatedFromUDB2($images));
510
    }
511
512
    /**
513
     * @param AbstractPublished $published
514
     */
515
    protected function applyPublished(AbstractPublished $published)
0 ignored issues
show
Unused Code introduced by
The parameter $published is not used and could be removed.

This check looks from parameters that have been defined for a function or method, but which are not used in the method body.

Loading history...
516
    {
517
        $this->workflowStatus = WorkflowStatus::READY_FOR_VALIDATION();
518
    }
519
520
    /**
521
     * @param AbstractApproved $approved
522
     */
523
    protected function applyApproved(AbstractApproved $approved)
0 ignored issues
show
Unused Code introduced by
The parameter $approved is not used and could be removed.

This check looks from parameters that have been defined for a function or method, but which are not used in the method body.

Loading history...
524
    {
525
        $this->workflowStatus = WorkflowStatus::APPROVED();
526
    }
527
528
    /**
529
     * @param AbstractRejected $rejected
530
     */
531
    protected function applyRejected(AbstractRejected $rejected)
532
    {
533
        $this->rejectedReason = $rejected->getReason();
534
        $this->workflowStatus = WorkflowStatus::REJECTED();
535
    }
536
537
    /**
538
     * @param AbstractFlaggedAsDuplicate $flaggedAsDuplicate
539
     */
540
    protected function applyFlaggedAsDuplicate(AbstractFlaggedAsDuplicate $flaggedAsDuplicate)
0 ignored issues
show
Unused Code introduced by
The parameter $flaggedAsDuplicate is not used and could be removed.

This check looks from parameters that have been defined for a function or method, but which are not used in the method body.

Loading history...
541
    {
542
        $this->rejectedReason = new StringLiteral(self::DUPLICATE_REASON);
543
        $this->workflowStatus = WorkflowStatus::REJECTED();
544
    }
545
546
    /**
547
     * @param AbstractFlaggedAsInappropriate $flaggedAsInappropriate
548
     */
549
    protected function applyFlaggedAsInappropriate(AbstractFlaggedAsInappropriate $flaggedAsInappropriate)
0 ignored issues
show
Unused Code introduced by
The parameter $flaggedAsInappropriate is not used and could be removed.

This check looks from parameters that have been defined for a function or method, but which are not used in the method body.

Loading history...
550
    {
551
        $this->rejectedReason = new StringLiteral(self::INAPPROPRIATE_REASON);
552
        $this->workflowStatus = WorkflowStatus::REJECTED();
553
    }
554
555
    protected function applyImageAdded(AbstractImageAdded $imageAdded)
556
    {
557
        $this->images = $this->images->with($imageAdded->getImage());
558
    }
559
560
    protected function applyImageRemoved(AbstractImageRemoved $imageRemoved)
561
    {
562
        $this->images = $this->images->without($imageRemoved->getImage());
563
    }
564
565
    protected function applyMainImageSelected(AbstractMainImageSelected $mainImageSelected)
566
    {
567
        $this->images = $this->images->withMain($mainImageSelected->getImage());
568
    }
569
570
    protected function applyOrganizerUpdated(AbstractOrganizerUpdated $organizerUpdated)
571
    {
572
        $this->organizerId = $organizerUpdated->getOrganizerId();
573
    }
574
575
    protected function applyOrganizerDeleted(AbstractOrganizerDeleted $organizerDeleted)
0 ignored issues
show
Unused Code introduced by
The parameter $organizerDeleted is not used and could be removed.

This check looks from parameters that have been defined for a function or method, but which are not used in the method body.

Loading history...
576
    {
577
        $this->organizerId = null;
578
    }
579
580
    /**
581
     * @param AbstractImagesImportedFromUDB2 $imagesImportedFromUDB2
582
     */
583
    protected function applyImagesImportedFromUDB2(AbstractImagesImportedFromUDB2 $imagesImportedFromUDB2)
584
    {
585
        $this->applyUdb2ImagesEvent($imagesImportedFromUDB2);
586
    }
587
588
    /**
589
     * @param AbstractImagesUpdatedFromUDB2 $imagesUpdatedFromUDB2
590
     */
591
    protected function applyImagesUpdatedFromUDB2(AbstractImagesUpdatedFromUDB2 $imagesUpdatedFromUDB2)
592
    {
593
        $this->applyUdb2ImagesEvent($imagesUpdatedFromUDB2);
594
    }
595
596
    /**
597
     * This indirect apply method can be called internally to deal with images coming from UDB2.
598
     * Imports from UDB2 only contain the native Dutch content.
599
     * @see https://github.com/cultuurnet/udb3-udb2-bridge/blob/db0a7ab2444f55bb3faae3d59b82b39aaeba253b/test/Media/ImageCollectionFactoryTest.php#L79-L103
600
     * Because of this we have to make sure translated images are left in place.
601
     *
602
     * @param AbstractImagesEvent $imagesEvent
603
     */
604
    protected function applyUdb2ImagesEvent(AbstractImagesEvent $imagesEvent)
605
    {
606
        $newMainImage = $imagesEvent->getImages()->getMain();
607
        $dutchImagesList = $imagesEvent->getImages()->toArray();
608
        $translatedImagesList = array_filter(
609
            $this->images->toArray(),
610
            function (Image $image) {
611
                return $image->getLanguage()->getCode() !== 'nl';
612
            }
613
        );
614
615
        $imagesList = array_merge($dutchImagesList, $translatedImagesList);
616
        $images = ImageCollection::fromArray($imagesList);
617
618
        $this->images = isset($newMainImage) ? $images->withMain($newMainImage) : $images;
619
    }
620
621
    /**
622
     * @param Label $label
623
     * @return AbstractLabelAdded
624
     */
625
    abstract protected function createLabelAddedEvent(Label $label);
626
627
    /**
628
     * @param Label $label
629
     * @return AbstractLabelRemoved
630
     */
631
    abstract protected function createLabelRemovedEvent(Label $label);
632
633
    /**
634
     * @param Language $language
635
     * @param StringLiteral $title
636
     * @return AbstractTitleTranslated
637
     */
638
    abstract protected function createTitleTranslatedEvent(Language $language, StringLiteral $title);
639
640
    /**
641
     * @param Language $language
642
     * @param StringLiteral $description
643
     * @return AbstractDescriptionTranslated
644
     */
645
    abstract protected function createDescriptionTranslatedEvent(Language $language, StringLiteral $description);
646
647
    /**
648
     * @param Image $image
649
     * @return AbstractImageAdded
650
     */
651
    abstract protected function createImageAddedEvent(Image $image);
652
653
    /**
654
     * @param Image $image
655
     * @return AbstractImageRemoved
656
     */
657
    abstract protected function createImageRemovedEvent(Image $image);
658
659
    /**
660
     * @param AbstractUpdateImage $updateImageCommand
661
     * @return AbstractImageUpdated
662
     */
663
    abstract protected function createImageUpdatedEvent(
664
        AbstractUpdateImage $updateImageCommand
665
    );
666
667
    /**
668
     * @param Image $image
669
     * @return AbstractMainImageSelected
670
     */
671
    abstract protected function createMainImageSelectedEvent(Image $image);
672
673
    /**
674
     * @return AbstractOfferDeleted
675
     */
676
    abstract protected function createOfferDeletedEvent();
677
678
    /**
679
     * @param string $description
680
     * @return AbstractDescriptionUpdated
681
     */
682
    abstract protected function createDescriptionUpdatedEvent($description);
683
684
    /**
685
     * @param Calendar $calendar
686
     * @return AbstractCalendarUpdated
687
     */
688
    abstract protected function createCalendarUpdatedEvent(Calendar $calendar);
689
690
    /**
691
     * @param string $typicalAgeRange
692
     * @return AbstractTypicalAgeRangeUpdated
693
     */
694
    abstract protected function createTypicalAgeRangeUpdatedEvent($typicalAgeRange);
695
696
    /**
697
     * @return AbstractTypicalAgeRangeDeleted
698
     */
699
    abstract protected function createTypicalAgeRangeDeletedEvent();
700
701
    /**
702
     * @param string $organizerId
703
     * @return AbstractOrganizerUpdated
704
     */
705
    abstract protected function createOrganizerUpdatedEvent($organizerId);
706
707
    /**
708
     * @param string $organizerId
709
     * @return AbstractOrganizerDeleted
710
     */
711
    abstract protected function createOrganizerDeletedEvent($organizerId);
712
713
    /**
714
     * @param ContactPoint $contactPoint
715
     * @return AbstractContactPointUpdated
716
     */
717
    abstract protected function createContactPointUpdatedEvent(ContactPoint $contactPoint);
718
719
    /**
720
     * @param BookingInfo $bookingInfo
721
     * @return AbstractBookingInfoUpdated
722
     */
723
    abstract protected function createBookingInfoUpdatedEvent(BookingInfo $bookingInfo);
724
725
    /**
726
     * @param PriceInfo $priceInfo
727
     * @return AbstractPriceInfoUpdated
728
     */
729
    abstract protected function createPriceInfoUpdatedEvent(PriceInfo $priceInfo);
730
731
    /**
732
     * @param \DateTimeInterface $publicationDate
733
     * @return AbstractPublished
734
     */
735
    abstract protected function createPublishedEvent(\DateTimeInterface $publicationDate);
736
737
    /**
738
     * @return AbstractApproved
739
     */
740
    abstract protected function createApprovedEvent();
741
742
    /**
743
     * @param StringLiteral $reason
744
     * @return AbstractRejected
745
     */
746
    abstract protected function createRejectedEvent(StringLiteral $reason);
747
748
    /**
749
     * @return AbstractFlaggedAsDuplicate
750
     */
751
    abstract protected function createFlaggedAsDuplicate();
752
753
    /**
754
     * @return AbstractFlaggedAsInappropriate
755
     */
756
    abstract protected function createFlaggedAsInappropriate();
757
758
    /**
759
     * @param ImageCollection $images
760
     * @return AbstractImagesImportedFromUDB2
761
     */
762
    abstract protected function createImagesImportedFromUDB2(ImageCollection $images);
763
764
    /**
765
     * @param ImageCollection $images
766
     * @return AbstractImagesUpdatedFromUDB2
767
     */
768
    abstract protected function createImagesUpdatedFromUDB2(ImageCollection $images);
769
}
770