TenantAtlas/apps/platform/app/Services/TenantConfiguration/ExchangePowerShellEvidenceNormalizer.php
Ahmed Darrazi 73d84c2706
Some checks failed
PR Fast Feedback / fast-feedback (pull_request) Failing after 1m14s
feat: add Exchange structured output readiness
2026-07-08 16:24:20 +02:00

55 lines
1.8 KiB
PHP

<?php
declare(strict_types=1);
namespace App\Services\TenantConfiguration;
final class ExchangePowerShellEvidenceNormalizer
{
/**
* @var list<string>
*/
public const INCLUDED_TYPES = [
'transportRule',
'remoteDomain',
'inboundConnector',
];
public function __construct(
private readonly ExchangeTransportRuleEvidenceNormalizer $transportRules,
private readonly ExchangeRemoteDomainEvidenceNormalizer $remoteDomains,
private readonly ExchangeInboundConnectorEvidenceNormalizer $inboundConnectors,
) {}
public function evaluate(ExchangePowerShellStructuredOutputEnvelope $envelope): ExchangePowerShellNormalizerReadiness
{
return match ($envelope->resourceType) {
'transportRule' => $this->transportRules->evaluate($envelope),
'remoteDomain' => $this->remoteDomains->evaluate($envelope),
'inboundConnector' => $this->inboundConnectors->evaluate($envelope),
default => ExchangePowerShellNormalizerReadiness::blocked(
resourceType: $envelope->resourceType,
definition: [
'resource_type' => $envelope->resourceType,
'source_surface' => ExchangePowerShellCommandContracts::SOURCE_SURFACE,
'included_types' => self::INCLUDED_TYPES,
],
blockers: ['blocked_target_not_ready'],
itemCount: $envelope->itemCount,
),
};
}
/**
* @return array<string, array<string, mixed>>
*/
public function definitions(): array
{
return [
'transportRule' => $this->transportRules->definition(),
'remoteDomain' => $this->remoteDomains->definition(),
'inboundConnector' => $this->inboundConnectors->definition(),
];
}
}