<?php

namespace App\Filament\Resources\RestoreRunResource\Pages;

use App\Filament\Resources\RestoreRunResource;
use Filament\Resources\Pages\ListRecords;

class ListRestoreRuns extends ListRecords
{
    protected static string $resource = RestoreRunResource::class;

    private function tableHasRecords(): bool
    {
        return $this->getTableRecords()->count() > 0;
    }

    protected function getHeaderActions(): array
    {
        return [
            RestoreRunResource::makeCreateAction()
                ->visible(fn (): bool => $this->tableHasRecords()),
        ];
    }
}
