#!D:\IDE\Anaconda3\envs\Microscope_Scan python
# -*- coding: UTF-8 -*-
"""
 @Author: Administrator
 @FileName: ObjectiveLevel.py
 @DateTime: 2025/4/8 20:13
 @SoftWare: PyCharm
 @Author  ：xsh
"""
class ObjectiveLevel(int):
    Objective1      = 1
    Objective10     = 2
    Objective40     = 3
    Objective20     = 4
    Objective63     = 5
    Objective100    = 6
    ObjectiveNone   = 7

    @classmethod
    def isLowObjective(cls, level: int) -> bool:
        return not cls.isHigObjective(level)

    @classmethod
    def isHigObjective(cls, level: int) -> bool:
        return level in (cls.Objective40, cls.Objective63, cls.Objective100)

    @classmethod
    def all(cls) -> list[int]:
        return [
            cls.Objective1,
            cls.Objective10,
            cls.Objective40,
            cls.Objective20,
            cls.Objective63,
            cls.Objective100,
            cls.ObjectiveNone,
        ]
    @staticmethod
    def toList() -> list[int]:
        return [
            ObjectiveLevel.Objective1   ,
            ObjectiveLevel.Objective10  ,
            ObjectiveLevel.Objective20  ,
            ObjectiveLevel.Objective40  ,
            ObjectiveLevel.Objective63  ,
            ObjectiveLevel.Objective100 ,
            ObjectiveLevel.ObjectiveNone,
        ]
    @staticmethod
    def toItem() -> dict[str, object]:
        return {
            '1  倍物镜': ObjectiveLevel.Objective1   ,
            '10 倍物镜': ObjectiveLevel.Objective10  ,
            '20 倍物镜': ObjectiveLevel.Objective20  ,
            '40 倍物镜': ObjectiveLevel.Objective40  ,
            '63 倍物镜': ObjectiveLevel.Objective63  ,
            '100倍物镜': ObjectiveLevel.Objective100 ,
            '未知物镜' : ObjectiveLevel.ObjectiveNone,

        }

    @classmethod
    def toDrys(cls) -> list[str]:
        return ['I', 'D', 'T']

    @classmethod
    def toDryItems(cls) -> dict[int, object]:
        return {
            0   : 'I',
            1   : 'D',
            2   : 'T',
        }
    @classmethod
    def toString(cls, value: int) -> str:
        return value if value in cls.all() else '7'

    @classmethod
    def toValue(cls, value: str) -> int:
        try:
            data: int = int(value)
            return data if data in cls.all() else 7
        except Exception as e:
            return 7

    @classmethod
    def toUiString(cls, value: int) -> str:
        return cls.toUiItem().get(value, '    ')

    @classmethod
    def toUiItem(cls) -> dict[object, object]:
        return {
            cls.Objective1        : '1X  ',
            cls.Objective10       : '10X ',
            cls.Objective20       : '20X ',
            cls.Objective40       : '40X ',
            cls.Objective63       : '60X ',
            cls.Objective100      : '100X',
            cls.ObjectiveNone     : '    ',
        }
    @staticmethod
    def toParameters() -> dict[object, object]:
        return {
            ObjectiveLevel.Objective1   : 1  ,
            ObjectiveLevel.Objective10  : 10 ,
            ObjectiveLevel.Objective40  : 1  ,
            ObjectiveLevel.Objective20  : 20 ,
            ObjectiveLevel.Objective63  : 1 ,
            ObjectiveLevel.Objective100 : 100,
            ObjectiveLevel.ObjectiveNone: 1  ,

        }

    @staticmethod
    def toObjectiveNA() -> dict[object, object]:
        return {
            ObjectiveLevel.Objective1   : 4     ,
            ObjectiveLevel.Objective10  : 32    ,
            ObjectiveLevel.Objective40  : 4     ,
            ObjectiveLevel.Objective20  : 55    ,
            ObjectiveLevel.Objective63  : 4     ,
            ObjectiveLevel.Objective100 : 132   ,
            ObjectiveLevel.ObjectiveNone: 4     ,

        }

    @classmethod
    def toArticleNo(cls) -> dict[object, object]:
        return {
            cls.Objective1      : '11566045'    ,
            cls.Objective10     : '11506431'    ,
            cls.Objective40     : '11566045'    ,
            cls.Objective20     : '11506519'    ,
            cls.Objective63     : '11566045'    ,
            cls.Objective100    : '11506525'    ,
            cls.ObjectiveNone   : '11566045'    ,
        }

    @classmethod
    def toMagnification(cls) -> dict[object, object]:
        return {
            cls.Objective1      : '1'           ,
            cls.Objective10     : '10'          ,
            cls.Objective40     : '1'           ,
            cls.Objective20     : '20'          ,
            cls.Objective63     : '1'           ,
            cls.Objective100    : '100'         ,
            cls.ObjectiveNone   : '1'           ,
        }

    @classmethod
    def toNames(cls) -> dict[object, object]:
        return {
            cls.Objective1      : ' '                               ,
            cls.Objective10     : '10x/0.32 HC PL FLUOTAR'          ,
            cls.Objective40     : ' '                               ,
            cls.Objective20     : '20x/0.55 HC PL FLUOTAR'          ,
            cls.Objective63     : ' '                               ,
            cls.Objective100    : '100x/1.32 HC PL FLUOTAR'         ,
            cls.ObjectiveNone   : ' '                               ,
        }

    @classmethod
    def toObjectiveDrys(cls) -> dict[object, object]:
         return {
             cls.Objective1   : 'D',
             cls.Objective10  : 'D',
             cls.Objective40  : 'D',
             cls.Objective20  : 'D',
             cls.Objective63  : 'I',
             cls.Objective100 : 'I',
             cls.ObjectiveNone: 'D',
         }
    @classmethod
    def isMono(cls, level: int) -> bool:
        return not bool(level == cls.Objective20 or level == cls.Objective40)

    @classmethod
    def isMicronucleus(cls, level: int) -> bool:
        return bool(level == cls.Objective20 or level == cls.Objective40)