from __future__ import annotations

from planemapper.models import Aircraft
from planemapper.renderer.icons import AircraftType, classify_aircraft_type


def _aircraft(**kwargs) -> Aircraft:
    defaults = {"icao": "ABC123", "lat": 53.0, "lon": -6.0}
    defaults.update(kwargs)
    return Aircraft(**defaults)


def test_category_a1_returns_ga_light() -> None:
    ac = _aircraft(category="A1")
    assert classify_aircraft_type(ac) == AircraftType.GA_LIGHT


def test_category_a7_returns_helicopter() -> None:
    ac = _aircraft(category="A7")
    assert classify_aircraft_type(ac) == AircraftType.HELICOPTER


def test_ba_callsign_returns_commercial() -> None:
    ac = _aircraft(callsign="BAW123")
    assert classify_aircraft_type(ac) == AircraftType.COMMERCIAL


def test_altitude_below_10000_returns_ga_light() -> None:
    ac = _aircraft(altitude_ft=5000)
    assert classify_aircraft_type(ac) == AircraftType.GA_LIGHT


def test_altitude_18000_returns_private_jet() -> None:
    ac = _aircraft(altitude_ft=18000)
    assert classify_aircraft_type(ac) == AircraftType.PRIVATE_JET


def test_altitude_38000_returns_airliner() -> None:
    ac = _aircraft(altitude_ft=38000)
    assert classify_aircraft_type(ac) == AircraftType.AIRLINER


def test_category_a3_returns_commercial() -> None:
    ac = _aircraft(category="A3")
    assert classify_aircraft_type(ac) == AircraftType.COMMERCIAL
