# Copyright 2026, Jiri Eischmann <jiri@eischmann.cz> and the meshy contributors
# SPDX-License-Identifier: GPL-3.0-or-later

"""Platform-agnostic camera/QR scanner service."""

from meshy.platforms import is_macos


def create_qr_scanner(window, on_result):
    """Create platform-appropriate QR scanner dialog.

    Args:
        window: Parent GTK window
        on_result: Callback function(data: str) called with QR code data

    Returns:
        QR scanner dialog instance with start() method
    """
    if is_macos():
        from meshy.platforms.macos.camera_avfoundation import QRScannerDialogMacOS
        return QRScannerDialogMacOS(window, on_result)
    else:
        from meshy.qr_scanner import QRScannerDialog
        return QRScannerDialog(window, on_result)
