#  Quapp Platform Project
#  qibo_device_factory.py
#  Copyright © CITYNOW Co. Ltd. All rights reserved.

from quapp_common.config.logging_config import logger
from quapp_common.enum.provider_tag import ProviderTag
from quapp_common.enum.sdk import Sdk
from quapp_common.factory.device_factory import DeviceFactory
from quapp_common.model.provider.provider import Provider

from ..model.device.quapp_qibo_device import QuappQiboDevice
from quapp_common.config.logging_config import logger


class QiboDeviceFactory(DeviceFactory):

    @staticmethod
    def create_device(provider: Provider, device_specification: str,
            authentication: dict, sdk: Sdk):
        logger.info("[QiboDeviceFactory] create_device()")

        provider_type = ProviderTag.resolve(provider.get_provider_type().value)

        if ProviderTag.QUAO_QUANTUM_SIMULATOR.__eq__(
                provider_type) and Sdk.QIBO.__eq__(sdk):
            logger.info("Created QUAPP_QUANTUM_SIMULATOR device")
            return QuappQiboDevice(provider, device_specification)

        raise Exception("Unsupported device!")
