<?php

namespace App\Filament\Resources\BackupScheduleResource\Pages;

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

class ListBackupSchedules extends ListRecords
{
    protected static string $resource = BackupScheduleResource::class;

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

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

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