<?php

namespace App\Filament\Resources\BackupSetResource\Pages;

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

class ListBackupSets extends ListRecords
{
    protected static string $resource = BackupSetResource::class;

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

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

    protected function getTableEmptyStateActions(): array
    {
        return [
            BackupSetResource::makeCreateAction(),
        ];
    }
}
