<?php

namespace App\Filament\Resources\ApiProviders\Pages;

use App\Filament\Resources\ApiProviders\ApiProviderResource;
use Filament\Resources\Pages\CreateRecord;
use Livewire\Attributes\On;

class CreateApiProvider extends CreateRecord
{
    public $testResultState = 'none';

    protected static string $resource = ApiProviderResource::class;

    #[On('testConnectionFinished')]
    public function onTestConnectionFinished($result)
    {
        $this->testResultState = $result;
    }

    protected function getHeaderActions(): array
    {
        // No record yet, so no dashboard link; keep header clean.
        return [];
    }

    protected function getRedirectUrl(): string
    {
        return $this->getResource()::getUrl('index');
    }
}
