<?php

declare(strict_types=1);

use App\Models\EnhanceJob;
use App\Services\Enhance\EnhanceProcessorFactory;
use App\Services\Enhance\Processors\ExternalWorkerEnhanceProcessor;
use App\Services\Enhance\Processors\StubEnhanceProcessor;
use Illuminate\Foundation\Testing\RefreshDatabase;
use Tests\TestCase;

uses(TestCase::class, RefreshDatabase::class);

it('returns the stub processor for the stub engine', function (): void {
    expect(app(EnhanceProcessorFactory::class)->make(EnhanceJob::ENGINE_STUB))->toBeInstanceOf(StubEnhanceProcessor::class);
});

it('returns the external worker processor for the external worker engine', function (): void {
    expect(app(EnhanceProcessorFactory::class)->make(EnhanceJob::ENGINE_EXTERNAL_WORKER))->toBeInstanceOf(ExternalWorkerEnhanceProcessor::class);
});

it('throws for an unknown enhance processor engine', function (): void {
    app(EnhanceProcessorFactory::class)->make('unknown-engine');
})->throws(RuntimeException::class);