TenantAtlas/apps/platform/app/Services/TenantConfiguration/ExchangePowerShellContentOnlyEvidenceGuard.php
Ahmed Darrazi 6a6d9173e8
Some checks failed
PR Fast Feedback / fast-feedback (pull_request) Failing after 1m14s
feat: add Exchange evidence capture adapter guard
2026-07-08 12:38:38 +02:00

38 lines
1.3 KiB
PHP

<?php
declare(strict_types=1);
namespace App\Services\TenantConfiguration;
use App\Models\TenantConfigurationResource;
use App\Models\TenantConfigurationResourceEvidence;
use App\Support\TenantConfiguration\ClaimState;
use App\Support\TenantConfiguration\CoverageLevel;
use App\Support\TenantConfiguration\EvidenceState;
use InvalidArgumentException;
final class ExchangePowerShellContentOnlyEvidenceGuard
{
public function maximumCoverageLevel(): CoverageLevel
{
return CoverageLevel::ContentBacked;
}
public function assertContentOnly(
TenantConfigurationResourceEvidence $evidence,
TenantConfigurationResource $resource,
): void {
if ($evidence->coverage_level !== CoverageLevel::ContentBacked) {
throw new InvalidArgumentException('Exchange PowerShell evidence exceeded the content-backed maximum.');
}
if ($evidence->evidence_state !== EvidenceState::ContentBacked) {
throw new InvalidArgumentException('Exchange PowerShell evidence state must remain content-backed.');
}
if ($resource->latest_claim_state !== ClaimState::InternalOnly) {
throw new InvalidArgumentException('Exchange PowerShell evidence must remain internal-only for this slice.');
}
}
}