<?php

declare(strict_types=1);

namespace App\Support\EnvironmentDashboard;

final readonly class EnvironmentDashboardSummary
{
    /**
    * @param  array{workspace:string,tenant:string,provider:?string,providerKey:?string,latestActivity:?string}  $context
     * @param  array{status:string,tone:string,headline:string,summary:string}  $posture
     * @param  list<array<string, mixed>>  $kpis
     * @param  list<array<string, mixed>>  $recommendedActions
     * @param  list<array<string, mixed>>  $governanceStatus
     * @param  list<array<string, mixed>>  $readinessCards
     * @param  array<string, mixed>|null  $activeOperationSummary
     * @param  list<array<string, mixed>>  $recentOperations
     */
    public function __construct(
        public array $context,
        public array $posture,
        public array $kpis,
        public array $recommendedActions,
        public array $governanceStatus,
        public array $readinessCards,
        public ?array $activeOperationSummary,
        public array $recentOperations,
        public ?string $pollingInterval,
    ) {}

    /**
     * @return array{
          *     context: array{workspace:string,tenant:string,provider:?string,providerKey:?string,latestActivity:?string},
     *     posture: array{status:string,tone:string,headline:string,summary:string},
     *     kpis: list<array<string, mixed>>,
     *     recommendedActions: list<array<string, mixed>>,
     *     governanceStatus: list<array<string, mixed>>,
     *     readinessCards: list<array<string, mixed>>,
    *     activeOperationSummary: array<string, mixed>|null,
     *     recentOperations: list<array<string, mixed>>,
     *     pollingInterval: ?string,
     * }
     */
    public function toArray(): array
    {
        return [
            'context' => $this->context,
            'posture' => $this->posture,
            'kpis' => $this->kpis,
            'recommendedActions' => $this->recommendedActions,
            'governanceStatus' => $this->governanceStatus,
            'readinessCards' => $this->readinessCards,
            'activeOperationSummary' => $this->activeOperationSummary,
            'recentOperations' => $this->recentOperations,
            'pollingInterval' => $this->pollingInterval,
        ];
    }
}