from components.flight_api import FlightAPI, FlightAPIBase
from components.sse_event_streamer import SSEEventStreamer, SSEEventStreamerBase

_flight_api: FlightAPIBase | None = None
_sse_streamer: SSEEventStreamerBase | None = None


def get_flight_api() -> FlightAPIBase:
    global _flight_api
    if _flight_api is None:
        _flight_api = FlightAPI()
    return _flight_api


def get_sse_streamer() -> SSEEventStreamerBase:
    global _sse_streamer
    if _sse_streamer is None:
        _sse_streamer = SSEEventStreamer()
    return _sse_streamer

