Automated PR for spec 427 Exchange Teams verified source contract enablement. Co-authored-by: Ahmed Darrazi <ahmed.darrazi@live.de> Reviewed-on: #494
70 lines
2.3 KiB
PHP
70 lines
2.3 KiB
PHP
<?php
|
|
|
|
declare(strict_types=1);
|
|
|
|
namespace App\Services\TenantConfiguration;
|
|
|
|
use App\Support\TenantConfiguration\CaptureOutcome;
|
|
|
|
final readonly class CoverageSourceContractDecision
|
|
{
|
|
public const CONTRACT_VERIFIED_PENDING_CAPTURE = 'contract_verified_pending_capture';
|
|
|
|
public const CONTRACT_BLOCKED_MISSING_SOURCE = 'contract_blocked_missing_source';
|
|
|
|
public const CONTRACT_BLOCKED_PERMISSION_UNCLEAR = 'contract_blocked_permission_unclear';
|
|
|
|
public const CONTRACT_BLOCKED_BETA_ONLY = 'contract_blocked_beta_only';
|
|
|
|
public const CONTRACT_BLOCKED_RESPONSE_SHAPE_UNSAFE = 'contract_blocked_response_shape_unsafe';
|
|
|
|
public const CONTRACT_BLOCKED_REPO_ADAPTER_MISSING = 'contract_blocked_repo_adapter_missing';
|
|
|
|
public const CONTRACT_BLOCKED_IDENTITY_UNSAFE = 'contract_blocked_identity_unsafe';
|
|
|
|
public const CONTRACT_BLOCKED_REDACTION_UNSAFE = 'contract_blocked_redaction_unsafe';
|
|
|
|
/**
|
|
* @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 ?string $sourceContractState = null,
|
|
public array $contract = [],
|
|
public array $sourceMetadata = [],
|
|
) {}
|
|
|
|
/**
|
|
* @return list<string>
|
|
*/
|
|
public static function sourceContractStates(): array
|
|
{
|
|
return [
|
|
self::CONTRACT_VERIFIED_PENDING_CAPTURE,
|
|
self::CONTRACT_BLOCKED_MISSING_SOURCE,
|
|
self::CONTRACT_BLOCKED_PERMISSION_UNCLEAR,
|
|
self::CONTRACT_BLOCKED_BETA_ONLY,
|
|
self::CONTRACT_BLOCKED_RESPONSE_SHAPE_UNSAFE,
|
|
self::CONTRACT_BLOCKED_REPO_ADAPTER_MISSING,
|
|
self::CONTRACT_BLOCKED_IDENTITY_UNSAFE,
|
|
self::CONTRACT_BLOCKED_REDACTION_UNSAFE,
|
|
];
|
|
}
|
|
|
|
public function capturable(): bool
|
|
{
|
|
return $this->outcome === CaptureOutcome::Captured
|
|
&& is_string($this->contractKey)
|
|
&& $this->contractKey !== ''
|
|
&& is_string($this->sourceEndpoint)
|
|
&& $this->sourceEndpoint !== '';
|
|
}
|
|
}
|