#!D:/IDE/anaconda3/envs/Microscope_Scan python
# -*- coding: UTF-8 -*-
"""
@FileName：WebAPIFactory.py
@Description：
@Author：XSH
@Time：2025/12/3 12:23
@Department：研发部
@Copyright：©2025 乐辰生物
"""
from PyQt5 import Qt
from abc import abstractmethod, abstractclassmethod, abstractstaticmethod
from AppInterfaces.utils                    import *
from AppSettings.utils                      import *
from AppCore.Requests                       import *
from AppInterfaces.Interfaces               import *
from AppCore.Levels                         import *
from AppUtils.utils                         import *
from AppBackEnd.WebAPIBusiness.WebApis      import *


class WebAPIFactory:
    @staticmethod
    def create(level: int, manager: WebReaderInterface = None, parent: Qt.QObject = None, **kwargs) -> WebBusinessInterface:
        """
        创建业务逻辑接口
        :param parent:
        :param manager:
        :param level:
        :return:
        """
        if level == WebAPILevel.exitScanning            :
            return ExitScanningBusiness(manager=manager, parent=parent, **kwargs)
        if level == WebAPILevel.jumpScanning            :
            return JumpScanningBusiness(manager=manager, parent=parent, **kwargs)
        if level == WebAPILevel.stopScan                :
            return StopScanningBusiness(manager=manager, parent=parent, **kwargs)
        if level == WebAPILevel.startScan               :
            return StartScanningBusiness(manager=manager, parent=parent, **kwargs)
        if level == WebAPILevel.pauseScan               :
            return PauseScanningBusiness(manager=manager, parent=parent, **kwargs)
        if level == WebAPILevel.getScanningData         :
            return ScanningDataBusiness(manager=manager, parent=parent, **kwargs)
        if level == WebAPILevel.scanComplete            :
            return ScanningCompleteBusiness(manager=manager, parent=parent, **kwargs)
        if level == WebAPILevel.getConnectionStatus     :
            return ConnectionStatusBusiness(manager=manager, parent=parent, **kwargs)
        if level == WebAPILevel.getScanningStatus       :
            return ScanningStatusBusiness(manager=manager, parent=parent, **kwargs)
        if level == WebAPILevel.getTempLate             :
            return SelectScanTemplateBusiness(manager=manager, parent=parent, **kwargs)
        if level == WebAPILevel.selectTemplateList      :
            return SelectScanTemplateBusiness(manager=manager, parent=parent, **kwargs)
        if level == WebAPILevel.selectClassifier        or level == WebAPILevel.getClassifiers:
            return SelectClassifierBusiness(manager=manager, parent=parent, **kwargs)
        if level == WebAPILevel.deleteTemplate          :
            return RemoveScanTemplateBusiness(manager=manager, parent=parent, **kwargs)
        if level == WebAPILevel.updateTempLate          :
            return UpdateScanTemplateBusiness(manager=manager, parent=parent, **kwargs)
        if level == WebAPILevel.saveTemplate            :
            return UpdateScanTemplateBusiness(manager=manager, parent=parent, **kwargs)
        if level == WebAPILevel.pushTemplate            :
            return PushTemplateBusiness(manager=manager, parent=parent, **kwargs)
        if level == WebAPILevel.focusingPosition        :
            return ScanningStatusBusiness(manager=manager, parent=parent, **kwargs)
        if level == WebAPILevel.getChamberStatus        :
            return ChamberStatusBusiness(manager=manager, parent=parent, **kwargs)
        if level == WebAPILevel.clearPreview            :
            return ClearPreviewBusiness(manager=manager, parent=parent, **kwargs)
        if level == WebAPILevel.clearWarning            :
            return ClearWarningBusiness(manager=manager, parent=parent, **kwargs)
        if level == WebAPILevel.setCustomData           :
            return SetCustomData(manager=manager, parent=parent, **kwargs)
        if level == WebAPILevel.getCustomData           :
            return GetCustomData(manager=manager, parent=parent, **kwargs)
        if level == WebAPILevel.dropSlideTableTray      :
            return DropSlideTableTrayBusiness(manager=manager, parent=parent, **kwargs)

        return NoneWebAPIBusiness(manager=manager, parent=parent, **kwargs)