Files
core/src/Shipping/DTOs/ManifestResult.php
T

29 lines
860 B
PHP

<?php
namespace Modules\Core\Shipping\DTOs;
use Illuminate\Support\Collection;
use Modules\Core\Shipping\Models\Manifest;
class ManifestResult
{
private function __construct(
public readonly bool $success,
public readonly ?string $reference,
public readonly ?Manifest $manifest,
public readonly Collection $includedShipments,
public readonly Collection $blockedShipments,
public readonly ?string $reason,
) {}
public static function success(Manifest $manifest, Collection $includedShipments): self
{
return new self(true, $manifest->reference, $manifest, $includedShipments, collect(), null);
}
public static function blocked(Collection $blockedShipments, string $reason): self
{
return new self(false, null, null, collect(), $blockedShipments, $reason);
}
}