TenantAtlas/apps/platform/app/Support/Providers/Readiness/ProviderReadinessResult.php
ahmido a6c064cbf1 feat: improve provider readiness semantics and freshness guidance (#465)
Automated PR created by Codex via Gitea API.

Co-authored-by: Ahmed Darrazi <ahmed.darrazi@live.de>
Reviewed-on: #465
2026-06-21 17:20:10 +00: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 : [],
];
}
}