<?php

use App\Models\PlayType;
use Database\Seeders\PlayTypeSeeder;
use Illuminate\Foundation\Testing\RefreshDatabase;
use App\Services\Settlement\SettlementMatcherRegistry;
use App\Services\Settlement\Matchers\NoopSettlementMatcher;

uses(RefreshDatabase::class);

beforeEach(fn () => $this->seed(PlayTypeSeeder::class));

test('every play_types.play_code maps to a non-noop settlement matcher', function (): void {
    $reg = app(SettlementMatcherRegistry::class);
    foreach (PlayType::query()->orderBy('play_code')->pluck('play_code') as $code) {
        $matcher = $reg->for((string) $code);
        expect($matcher)->not->toBeInstanceOf(NoopSettlementMatcher::class);
    }
});

test('half_box reuses the same matcher instance as big spread', function (): void {
    $reg = app(SettlementMatcherRegistry::class);
    expect($reg->for('half_box'))->toBe($reg->for('big'));
});
