<?php

use App\Enums\FuelType;

it('maps UK API uppercase values to the canonical lowercase enum', function () {
    expect(FuelType::fromApiValue('E10'))->toBe(FuelType::E10)
        ->and(FuelType::fromApiValue('B7_STANDARD'))->toBe(FuelType::B7Standard)
        ->and(FuelType::fromApiValue('HVO'))->toBe(FuelType::Hvo);
});

it('accepts already-lowercase values', function () {
    expect(FuelType::fromApiValue('e5'))->toBe(FuelType::E5);
});

it('exposes a human label for each case', function () {
    expect(FuelType::E10->label())->toBe('Petrol (E10)')
        ->and(FuelType::B7Standard->label())->toBe('Diesel (B7)')
        ->and(FuelType::Hvo->label())->toBe('HVO');
});

it('throws ValueError for unknown fuel types', function () {
    FuelType::fromApiValue('avgas');
})->throws(ValueError::class);
