TenantAtlas/apps/platform/app/Support/Providers/Capabilities/ProviderCapabilityResult.php
ahmido 1debe40ced feat: implement provider capability registry (#342)
## Summary
- implement the provider capability registry and derived capability evaluation flow
- update provider connections, onboarding, required-permissions diagnostics, and provider blocker translation to use capability-first summaries
- add bounded unit, feature, and browser test coverage plus the prepared Spec 283 artifacts

## Notes
- branch: `283-provider-capability-registry`
- commit: `74e75c3e`
- no additional validation commands were run in this git/PR flow step

Co-authored-by: Ahmed Darrazi <ahmed.darrazi@live.de>
Reviewed-on: #342
2026-05-08 21:17:05 +00:00

71 lines
2.3 KiB
PHP

<?php
declare(strict_types=1);
namespace App\Support\Providers\Capabilities;
final readonly class ProviderCapabilityResult
{
/**
* @param array<int, string> $providerRequirementKeys
* @param array<int, string> $missingRequirementKeys
* @param array<string, int> $evidenceCounts
*/
public function __construct(
public string $key,
public string $label,
public ProviderCapabilityStatus $status,
public ?string $reasonCode = null,
public array $providerRequirementKeys = [],
public array $missingRequirementKeys = [],
public ?string $lastCheckedAt = null,
public ?string $primaryMessage = null,
public ?string $providerHint = null,
public array $evidenceCounts = [],
public ?string $nextStepLabel = null,
public ?string $nextStepUrl = null,
) {}
public function blocksExecution(): bool
{
return $this->status->blocksExecution();
}
/**
* @return array{
* provider_capability_key: string,
* label: string,
* status: string,
* reason_code: ?string,
* provider_requirement_keys: array<int, string>,
* missing_requirement_keys: array<int, string>,
* last_checked_at: ?string,
* primary_message: ?string,
* provider_hint: ?string,
* evidence_counts: array<string, int>,
* next_step: array{label: ?string, url: ?string},
* blocks_execution: bool
* }
*/
public function toArray(): array
{
return [
'provider_capability_key' => $this->key,
'label' => $this->label,
'status' => $this->status->value,
'reason_code' => $this->reasonCode,
'provider_requirement_keys' => $this->providerRequirementKeys,
'missing_requirement_keys' => $this->missingRequirementKeys,
'last_checked_at' => $this->lastCheckedAt,
'primary_message' => $this->primaryMessage,
'provider_hint' => $this->providerHint,
'evidence_counts' => $this->evidenceCounts,
'next_step' => [
'label' => $this->nextStepLabel,
'url' => $this->nextStepUrl,
],
'blocks_execution' => $this->blocksExecution(),
];
}
}