TenantAtlas/apps/platform/app/Support/Providers/Readiness/ProviderReadinessResult.php
Ahmed Darrazi 1245af12af
Some checks failed
PR Fast Feedback / fast-feedback (pull_request) Failing after 1m25s
feat: improve provider readiness semantics and freshness guidance
2026-06-21 19:18:00 +02:00

56 lines
1.9 KiB
PHP

<?php
declare(strict_types=1);
namespace App\Support\Providers\Readiness;
final readonly class ProviderReadinessResult
{
/**
* @param array<string, int> $counts
* @param array<int, array<string, mixed>> $permissionRows
* @param array<string, mixed> $freshness
* @param array<string, mixed>|null $recommendedAction
* @param array<int, array<string, mixed>> $childResults
* @param array<string, mixed> $technical
*/
public function __construct(
public string $provider,
public ?int $workspaceId,
public ?int $managedEnvironmentId,
public ?int $providerConnectionId,
public ProviderReadinessState $state,
public array $counts,
public array $permissionRows,
public array $freshness,
public bool $canManageProvider,
public bool $canViewTechnicalDetail,
public ?array $recommendedAction = null,
public array $childResults = [],
public array $technical = [],
) {}
/**
* @return array<string, mixed>
*/
public function toArray(): array
{
return [
'provider' => $this->provider,
'workspace_id' => $this->workspaceId,
'managed_environment_id' => $this->managedEnvironmentId,
'provider_connection_id' => $this->providerConnectionId,
'state' => $this->state->value,
'state_label' => $this->state->label(),
'counts' => $this->counts,
'permission_rows' => $this->permissionRows,
'freshness' => $this->freshness,
'can_manage_provider' => $this->canManageProvider,
'can_view_technical_detail' => $this->canViewTechnicalDetail,
'recommended_action' => $this->recommendedAction,
'child_results' => $this->childResults,
'technical' => $this->canViewTechnicalDetail ? $this->technical : [],
];
}
}