"""Screen capture engine abstraction layer."""

from wled_controller.core.capture_engines.base import (
    CaptureEngine,
    CaptureStream,
    DisplayInfo,
    ScreenCapture,
)
from wled_controller.core.capture_engines.factory import EngineRegistry
from wled_controller.core.capture_engines.mss_engine import MSSEngine, MSSCaptureStream
from wled_controller.core.capture_engines.dxcam_engine import DXcamEngine, DXcamCaptureStream
from wled_controller.core.capture_engines.bettercam_engine import BetterCamEngine, BetterCamCaptureStream
from wled_controller.core.capture_engines.wgc_engine import WGCEngine, WGCCaptureStream
from wled_controller.core.capture_engines.scrcpy_engine import ScrcpyEngine, ScrcpyCaptureStream
from wled_controller.core.capture_engines.demo_engine import DemoCaptureEngine, DemoCaptureStream

# Camera engine requires OpenCV — optional dependency
try:
    from wled_controller.core.capture_engines.camera_engine import CameraEngine, CameraCaptureStream
    _has_camera = True
except ImportError:
    _has_camera = False

# Auto-register available engines
EngineRegistry.register(MSSEngine)
EngineRegistry.register(DXcamEngine)
EngineRegistry.register(BetterCamEngine)
EngineRegistry.register(WGCEngine)
EngineRegistry.register(ScrcpyEngine)
if _has_camera:
    EngineRegistry.register(CameraEngine)
EngineRegistry.register(DemoCaptureEngine)

__all__ = [
    "CaptureEngine",
    "CaptureStream",
    "DisplayInfo",
    "ScreenCapture",
    "EngineRegistry",
    "MSSEngine",
    "MSSCaptureStream",
    "DXcamEngine",
    "DXcamCaptureStream",
    "BetterCamEngine",
    "BetterCamCaptureStream",
    "WGCEngine",
    "WGCCaptureStream",
    "ScrcpyEngine",
    "ScrcpyCaptureStream",
    "DemoCaptureEngine",
    "DemoCaptureStream",
]

if _has_camera:
    __all__ += ["CameraEngine", "CameraCaptureStream"]
