TenantAtlas/apps/platform/app/Services/TenantConfiguration/CoverageSourceContractDecision.php
Ahmed Darrazi 736e61c73e
Some checks failed
PR Fast Feedback / fast-feedback (pull_request) Failing after 1m37s
feat: add generic content-backed coverage capture
2026-06-25 21:55:27 +02:00

36 lines
1023 B
PHP

<?php
declare(strict_types=1);
namespace App\Services\TenantConfiguration;
use App\Support\TenantConfiguration\CaptureOutcome;
final readonly class CoverageSourceContractDecision
{
/**
* @param array<string, mixed> $contract
* @param array<string, mixed> $sourceMetadata
*/
public function __construct(
public string $canonicalType,
public CaptureOutcome $outcome,
public ?string $contractKey = null,
public ?string $sourceEndpoint = null,
public string $sourceVersion = 'v1.0',
public ?string $sourceSchemaHash = null,
public ?string $reasonCode = null,
public array $contract = [],
public array $sourceMetadata = [],
) {}
public function capturable(): bool
{
return $this->outcome === CaptureOutcome::Captured
&& is_string($this->contractKey)
&& $this->contractKey !== ''
&& is_string($this->sourceEndpoint)
&& $this->sourceEndpoint !== '';
}
}