TenantAtlas/apps/platform/app/Services/TenantConfiguration/ExchangeRemoteDomainEvidenceNormalizer.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

76 lines
1.9 KiB
PHP

<?php
declare(strict_types=1);
namespace App\Services\TenantConfiguration;
final class ExchangeRemoteDomainEvidenceNormalizer extends ExchangePowerShellTargetEvidenceNormalizer
{
public function resourceType(): string
{
return 'remoteDomain';
}
public function normalizerVersion(): string
{
return 'exchange-remote-domain-readiness-v1';
}
/**
* @return list<string>
*/
protected function materialFields(): array
{
return [
'Guid',
'RemoteDomainId',
'Identity',
'DomainName',
'Name',
'DisplayName',
'IsDefault',
'AllowedOOFType',
'AutoReplyEnabled',
'AutoForwardEnabled',
'MailTipsAccessLevel',
'MailTipsAccessScope',
'TargetDeliveryDomain',
'TNEFEnabled',
'TrustedMailOutboundEnabled',
];
}
/**
* @return list<list<string>>
*/
protected function identityAliasGroups(): array
{
return [
['id', 'sourceId'],
['Guid', 'RemoteDomainId', 'Identity'],
];
}
protected function normalizePayload(array $payload, array $identity): array
{
$normalized = parent::normalizePayload($payload, $identity);
$normalized['remote_domain_class'] = [
'is_default' => $this->normalizeSettingValue($payload['IsDefault'] ?? $payload['isDefault'] ?? null),
'domain_name_is_identity' => false,
];
$normalized['settings'] = $this->settingGroup($payload, [], [
'AllowedOOFType',
'AutoReplyEnabled',
'AutoForwardEnabled',
'MailTipsAccessLevel',
'MailTipsAccessScope',
'TargetDeliveryDomain',
'TNEFEnabled',
'TrustedMailOutboundEnabled',
]);
return $this->sortAssociative($normalized);
}
}