2026-07-19 00:50:15 +03:00
|
|
|
<?php
|
|
|
|
|
|
2026-09-03 15:58:51 +03:00
|
|
|
namespace Modules\Core\Shipping\DTOs;
|
2026-07-19 00:50:15 +03:00
|
|
|
|
|
|
|
|
use Illuminate\Support\Collection;
|
2026-09-14 00:03:06 +03:00
|
|
|
use Modules\Core\Shipping\Models\Manifest;
|
2026-07-19 00:50:15 +03:00
|
|
|
|
|
|
|
|
class ManifestResult
|
|
|
|
|
{
|
|
|
|
|
private function __construct(
|
|
|
|
|
public readonly bool $success,
|
|
|
|
|
public readonly ?string $reference,
|
2026-09-14 00:03:06 +03:00
|
|
|
public readonly ?Manifest $manifest,
|
2026-07-19 00:50:15 +03:00
|
|
|
public readonly Collection $includedShipments,
|
|
|
|
|
public readonly Collection $blockedShipments,
|
|
|
|
|
public readonly ?string $reason,
|
|
|
|
|
) {}
|
|
|
|
|
|
2026-09-14 00:03:06 +03:00
|
|
|
public static function success(Manifest $manifest, Collection $includedShipments): self
|
2026-07-19 00:50:15 +03:00
|
|
|
{
|
2026-09-14 00:03:06 +03:00
|
|
|
return new self(true, $manifest->reference, $manifest, $includedShipments, collect(), null);
|
2026-07-19 00:50:15 +03:00
|
|
|
}
|
|
|
|
|
|
|
|
|
|
public static function blocked(Collection $blockedShipments, string $reason): self
|
|
|
|
|
{
|
2026-09-14 00:03:06 +03:00
|
|
|
return new self(false, null, null, collect(), $blockedShipments, $reason);
|
2026-07-19 00:50:15 +03:00
|
|
|
}
|
|
|
|
|
}
|