48 lines
1.2 KiB
PHP
48 lines
1.2 KiB
PHP
<?php
|
|
|
|
declare(strict_types=1);
|
|
|
|
namespace App\Services\Evidence;
|
|
|
|
use App\Models\EvidenceSnapshot;
|
|
|
|
final class EvidenceResolutionResult
|
|
{
|
|
/**
|
|
* @param list<string> $eligibleDimensions
|
|
* @param list<string> $reasons
|
|
*/
|
|
private function __construct(
|
|
public readonly string $outcome,
|
|
public readonly ?EvidenceSnapshot $snapshot,
|
|
public readonly array $eligibleDimensions = [],
|
|
public readonly array $reasons = [],
|
|
) {}
|
|
|
|
public static function resolved(EvidenceSnapshot $snapshot, array $eligibleDimensions): self
|
|
{
|
|
return new self('resolved', $snapshot, $eligibleDimensions, []);
|
|
}
|
|
|
|
/**
|
|
* @param list<string> $reasons
|
|
*/
|
|
public static function missingSnapshot(array $reasons = []): self
|
|
{
|
|
return new self('missing_snapshot', null, [], $reasons);
|
|
}
|
|
|
|
/**
|
|
* @param list<string> $reasons
|
|
*/
|
|
public static function snapshotIneligible(EvidenceSnapshot $snapshot, array $reasons): self
|
|
{
|
|
return new self('snapshot_ineligible', $snapshot, [], $reasons);
|
|
}
|
|
|
|
public function isResolved(): bool
|
|
{
|
|
return $this->outcome === 'resolved' && $this->snapshot instanceof EvidenceSnapshot;
|
|
}
|
|
}
|