- Introduced ApplyPickTimeSlotOutput class for structured output. - Updated ApplyPickTimeSlot action to return ApplyPickTimeSlotOutput. - Added ApplyPickTimeSlotStatus enum for status representation. - Modified TunnelController to handle new output structure. - Enhanced tests for ApplyPickTimeSlot to validate new behavior.
32 lines
705 B
PHP
32 lines
705 B
PHP
<?php
|
|
|
|
declare(strict_types=1);
|
|
|
|
namespace App\Cqs\Actions\Orders;
|
|
|
|
use App\Enums\ApplyPickTimeSlotStatus;
|
|
use Domain\Models\ValueObjects\PickupTimeSlot;
|
|
|
|
final readonly class ApplyPickTimeSlotOutput
|
|
{
|
|
public function __construct(
|
|
public ApplyPickTimeSlotStatus $status,
|
|
public ?PickupTimeSlot $timeSlot = null,
|
|
) {
|
|
}
|
|
|
|
public static function matched(PickupTimeSlot $timeSlot): self
|
|
{
|
|
return new self(
|
|
status: ApplyPickTimeSlotStatus::MATCHED,
|
|
timeSlot: $timeSlot,
|
|
);
|
|
}
|
|
|
|
public static function unavailable(): self
|
|
{
|
|
return new self(
|
|
status: ApplyPickTimeSlotStatus::UNAVAILABLE,
|
|
);
|
|
}
|
|
}
|