<?php

declare(strict_types=1);

namespace App\Filament\Widgets\ManagedEnvironment;

use App\Models\ManagedEnvironment;
use App\Support\Tenants\TenantLifecyclePresentation;
use Filament\Facades\Filament;
use Filament\Widgets\Widget;

class ManagedEnvironmentArchivedBanner extends Widget
{
    protected static bool $isLazy = false;

    protected string $view = 'filament.widgets.managed-environment.managed-environment-archived-banner';

    /**
     * @return array<string, mixed>
     */
    protected function getViewData(): array
    {
        $tenant = Filament::getTenant();

        return [
            'tenant' => $tenant instanceof ManagedEnvironment ? $tenant : null,
            'presentation' => $tenant instanceof ManagedEnvironment ? TenantLifecyclePresentation::fromTenant($tenant) : null,
        ];
    }
}
