"""Mock device provider — virtual LED strip for testing."""

from datetime import datetime, timezone
from typing import List

from wled_controller.core.devices.led_client import (
    DeviceHealth,
    DiscoveredDevice,
    LEDClient,
    LEDDeviceProvider,
)
from wled_controller.core.devices.mock_client import MockClient


class MockDeviceProvider(LEDDeviceProvider):
    """Provider for virtual mock LED devices."""

    @property
    def device_type(self) -> str:
        return "mock"

    @property
    def capabilities(self) -> set:
        return {"manual_led_count", "power_control", "brightness_control"}

    def create_client(self, url: str, **kwargs) -> LEDClient:
        return MockClient(
            url,
            led_count=kwargs.get("led_count", 0),
            send_latency_ms=kwargs.get("send_latency_ms", 0),
        )

    async def check_health(self, url: str, http_client, prev_health=None) -> DeviceHealth:
        return DeviceHealth(online=True, latency_ms=0.0, last_checked=datetime.now(timezone.utc))

    async def validate_device(self, url: str) -> dict:
        return {}

    async def discover(self, timeout: float = 3.0) -> List[DiscoveredDevice]:
        return []

    async def get_power(self, url: str, **kwargs) -> bool:
        return True

    async def set_power(self, url: str, on: bool, **kwargs) -> None:
        pass
