<?php

declare(strict_types=1);

use App\Services\RegionTagResolver;
use App\Support\RussianRegions;

it('resolves subject name to code', function (): void {
    $r = new RegionTagResolver;
    expect($r->resolve('Москва'))->toBe(82)
        ->and($r->resolve('Санкт-Петербург'))->toBe(83)
        ->and($r->resolve('Республика Адыгея'))->toBe(1);
});

it('returns null for «РФ» pool tag, empty and unknown', function (): void {
    $r = new RegionTagResolver;
    expect($r->resolve('РФ'))->toBeNull()
        ->and($r->resolve(''))->toBeNull()
        ->and($r->resolve('Нарния'))->toBeNull();
});

it('canonical region map mirrors regions.ts — exactly 89 subjects', function (): void {
    expect(count(RussianRegions::CODE_TO_NAME))->toBe(89);
});
