#!D:/IDE/anaconda3/envs python
# -*- coding: UTF-8 -*-
"""
 @Author: Administrator
 @FileName：ObjectModel.py\n
 @DateTime: 2025/6/23 14:45\n
 @Author  ：xsh
"""
from PyQt5 import Qt
from datetime import datetime, date
import copy
from AppSettings.Settings import *
from AppCore.AppDBModels.CoreModel import (CoreModel, DBManager, dbController)
from sqlalchemy.orm import declarative_base, mapper, sessionmaker, Session
from sqlalchemy.orm import (declarative_base, Mapped, mapped_column, relationship, mapper, sessionmaker)
from sqlalchemy import Table, Engine, create_engine, Column, ForeignKey, and_, or_, insert, delete, update, select, func, ColumnElement,distinct
from sqlalchemy.types import (Text, VARCHAR, REAL, Float, Integer, String, SmallInteger, DateTime, Date, ARRAY,Boolean, JSON)
from sqlalchemy.orm.decl_api import DeclarativeBase, MetaData
from AppUtils.utils import *
from AppCore.Levels import *

class ObjectiveModel(CoreModel):
    __tablename__ = 't_ObjectiveModel'
    Information                     : Mapped[str    ] = mapped_column(Text, default=''      , nullable=True , doc='说明信息　　')
    Level                           : Mapped[int    ] = mapped_column(primary_key=True      , nullable=False, doc='物镜类型　　')
    LAMP                            : Mapped[float  ] = mapped_column(default=1             , nullable=True , doc='光源强度　　')
    APBL                            : Mapped[float  ] = mapped_column(default=10            , nullable=True , doc='孔径光阑　　')
    LFBL                            : Mapped[float  ] = mapped_column(default=30            , nullable=True , doc='视场光阑　　')
    Lower_Limit                     : Mapped[float  ] = mapped_column(default=5000.0        , nullable=True , doc='位置下限　　')
    Upper_Limit                     : Mapped[float  ] = mapped_column(default=24800000.0    , nullable=True , doc='位置上限　　')
    Focus_Lower_Limit               : Mapped[float  ] = mapped_column(default=5000.0        , nullable=True , doc='定焦位置下限')
    Focus_Upper_Limit               : Mapped[float  ] = mapped_column(default=24800000.0    , nullable=True , doc='定焦位置上限')
    Safe_Limit                      : Mapped[float  ] = mapped_column(default=0             , nullable=True , doc='三次核型速度')
    Focus_Speed                     : Mapped[float  ] = mapped_column(default=6000.0        , nullable=True , doc='定焦移动速度')
    Default_Speed                   : Mapped[float  ] = mapped_column(default=6000.0        , nullable=True , doc='默认移动速度')
    Scan_Speed                      : Mapped[float  ] = mapped_column(default=6000.0        , nullable=True , doc='平扫移动速度')
    MinFocusCount                   : Mapped[float  ] = mapped_column(default=6             , nullable=True , doc='最小定焦点位')
    FocusingCount                   : Mapped[float  ] = mapped_column(default=2             , nullable=True , doc='定焦次数　　')
    FocalDistance                   : Mapped[float  ] = mapped_column(default=-8000         , nullable=True , doc='正常焦点间距')
    OilFocalDistance                : Mapped[float  ] = mapped_column(default=-8000         , nullable=True , doc='有油焦点间距')
    FocusingOffset                  : Mapped[float  ] = mapped_column(default=-8000         , nullable=True , doc='定焦轴偏移量')
    ObjectiveOffset                 : Mapped[float  ] = mapped_column(default=1500000       , nullable=True , doc='物镜轴偏移量')
    def __init__(self, **args):
        super(ObjectiveModel, self).__init__()
        self.initialize()
        self.initParameter(**args)

    def initParameter(self, **args):
        super(ObjectiveModel, self).initParameter(**args)
        self.flushInfo()

    @classmethod
    def Instance(cls, level: int, **args):
        result: cls = cls.__new__(cls)
        result.__init__()
        result.setLevel(level)
        result.initParameter(**args)
        return result




    def setLevel(self, level: int):
        if level == ObjectiveLevel.Objective1:
            self.initObjective1()
        elif level == ObjectiveLevel.Objective10:
            self.initObjective10()
        elif level == ObjectiveLevel.Objective20:
            self.initObjective20()
        elif level == ObjectiveLevel.Objective40:
            self.initObjective40()
        elif level == ObjectiveLevel.Objective63:
            self.initObjective63()
        elif level == ObjectiveLevel.Objective100:
            self.initObjective100()
        else:
            self.initObjectiveNone()
    def flushInfo(self):
        if self.Level == ObjectiveLevel.Objective1    :
            self.Information = '１　　倍物镜相机参数'
        elif self.Level == ObjectiveLevel.Objective10   :
            self.Information = '１０　倍物镜相机参数'
        elif self.Level == ObjectiveLevel.Objective20   :
            self.Information = '２０　倍物镜相机参数'
        elif self.Level == ObjectiveLevel.Objective40   :
            self.Information = '４０　倍物镜相机参数'
        elif self.Level == ObjectiveLevel.Objective63   :
            self.Information = '６３　倍物镜相机参数'
        elif self.Level == ObjectiveLevel.Objective100  :
            self.Information = '１００倍物镜相机参数'
        elif self.Level == ObjectiveLevel.ObjectiveNone :
            self.Information = '未知物镜相机参数　　'


    @classmethod
    def getObjectiveConfig(cls, level: int) -> 'ObjectiveModel':
        item: cls
        if level in ObjectiveLevel.all():
            try:
                dbController.initEngine()
                with Session(dbController.Engine) as session:
                    item = session.query(cls).filter(cls.Level == level).first()
                    session.close()
            except Exception as e:
                AppUtils.print_Exception(e)
                item = cls.Instance(level=level)
                item.setDefaultObjective(level)
        else:
            item = cls.Instance(level=level)
            item.setDefaultObjective(level)

        return item

    @classmethod
    def changedFocusingOffset(cls, level: int, offset: int):
        try:
            dbController.initEngine()
            with Session(dbController.Engine) as session:
                item = session.query(cls).filter(cls.Level == level).update({cls.FocusingOffset: offset})
                session.commit()
                session.close()
        except Exception as e:
            AppUtils.print_Exception(e)
            item.setDefaultObjective(level)
    @classmethod
    def getConfig(cls, level: int) -> 'ObjectiveModel':
        item: cls
        if level in ObjectiveLevel.all():
            try:
                dbController.initEngine()
                with Session(dbController.Engine) as session:
                    item = session.query(cls).filter(cls.Level == level).first()
                    session.close()
            except Exception as e:
                AppUtils.print_Exception(e)
                item = cls.Instance(level=level)
                item.setDefaultObjective(level)
        else:
            item = cls.Instance(level=level)
            item.setDefaultObjective(level)

        return item


    def setDefaultObjective(self, level: int):
        self.Level = level
        if self.Level == ObjectiveLevel.Objective1    :
            self.initObjective1()
        elif self.Level == ObjectiveLevel.Objective10   :
            self.initObjective10()
        elif self.Level == ObjectiveLevel.Objective20   :
            self.initObjective20()
        elif self.Level == ObjectiveLevel.Objective40   :
            self.initObjective40()
        elif self.Level == ObjectiveLevel.Objective63   :
            self.initObjective63()
        elif self.Level == ObjectiveLevel.Objective100  :
            self.initObjective100()
        elif self.Level == ObjectiveLevel.ObjectiveNone :
            self.initObjectiveNone()
        else:
            self.initObjectiveNone()


    @classmethod
    def setFocusingLimit(cls, level: int, min_limit: int = 5000.0, max_limit: int = 25000000.0) -> int:
        isWrong: int = RECODE_FAILURE
        try:
            cls.model_update({cls.Focus_Lower_Limit: min_limit, cls.Focus_Upper_Limit: max_limit}, cls.Level == level)
        except Exception as e:
            AppUtils.print_Exception(e)
        return isWrong

    @classmethod
    def setCustomFocusing(cls, level: int, focusing: int):
        isWrong: int = RECODE_FAILURE
        try:
            from AppCore.AppDBModels.ConfigModels.FocusingConfigModel import FocusingConfigModel
            model: FocusingConfigModel = FocusingConfigModel.FocusingConfig(level, ScanStatusLevel.Low_First_Focus_Status)
            if model is None:
                return
            min_limit = focusing - model.FocusingRange
            max_limit = focusing + model.FocusingRange
            cls.model_update({cls.Focus_Lower_Limit: min_limit, cls.Focus_Upper_Limit: max_limit}, cls.Level == level)
        except Exception as e:
            AppUtils.print_Exception(e)
        return isWrong



    @classmethod
    def getFocalDistance(cls, level: int) -> int:
        model: cls = cls.Primary(level)
        if model is None:
            model = cls.Instance(level=ObjectiveLevel.ObjectiveNone)
        return model.FocalDistance

    @classmethod
    def getOilFocalDistance(cls, level: int) -> int:
        model: cls = cls.Primary(level)
        if model is None:
            model = cls.Instance(level=ObjectiveLevel.ObjectiveNone)
        return model.OilFocalDistance


    @classmethod
    def getMinFocusingCount(cls, level: int) -> int:
        model: cls = cls.Primary(level)
        if model is None:
            model = cls.Instance(level=ObjectiveLevel.ObjectiveNone)
        return model.MinFocusCount

    @classmethod
    def getFocusingCount(cls, level: int) -> int:
        model: cls = cls.Primary(level)
        if model is None:
            model = cls.Instance(level=ObjectiveLevel.ObjectiveNone)
        return model.FocusingCount

    def initObjective1      (self):
        self.Information                 = '１　　倍物镜相机参数'              # '说明信息　　'
        self.Level                       = ObjectiveLevel.Objective1       # '物镜类型　　'
        self.LAMP                        = 1                               # '光源强度　　'
        self.APBL                        = 10                              # '孔径光阑　　'
        self.LFBL                        = 30                              # '视场光阑　　'
        self.Lower_Limit                 = 5000.0                          # '位置下限　　'
        self.Upper_Limit                 = 24800000.0                      # '位置上限　　'
        self.Focus_Lower_Limit           = 5000.0                          # '定焦位置下限'
        self.Focus_Upper_Limit           = 24800000.0                      # '定焦位置上限'
        self.Safe_Limit                  = 5000.0                          # '三次核型速度'
        self.Focus_Speed                 = 6000.0                          # '定焦移动速度'
        self.Default_Speed               = 6000.0                          # '默认移动速度'
        self.Scan_Speed                  = 6000.0                          # '平扫移动速度'
        self.MinFocusCount               = 6                               # '最小定焦点位'
        self.FocusingCount               = 2                               # '定焦次数　　'
        self.FocalDistance               = -8000                           # '正常焦点间距'
        self.OilFocalDistance            = -8000                           # '有油焦点间距'
        self.FocusingOffset              = -8000                           # '定焦轴偏移量'
        self.ObjectiveOffset             = 1500000                         # '物镜轴偏移量'
        self.flushInfo()

        pass
    def initObjective10     (self):
        self.Information                 = '１０　倍物镜相机参数'              # '说明信息　　'
        self.Level                       = ObjectiveLevel.Objective10      # '物镜类型　　'
        self.LAMP                        = 200                             # '光源强度　　'
        self.APBL                        = 8                               # '孔径光阑　　'
        self.LFBL                        = 30                              # '视场光阑　　'
        self.Lower_Limit                 = 5000.0                          # '位置下限　　'
        self.Upper_Limit                 = 24800000.0                      # '位置上限　　'
        self.Focus_Lower_Limit           = 5000.0                          # '定焦位置下限'
        self.Focus_Upper_Limit           = 24800000.0                      # '定焦位置上限'
        self.Safe_Limit                  = 5000.0                          # '三次核型速度'
        self.Focus_Speed                 = 6000.0                          # '定焦移动速度'
        self.Default_Speed               = 6000.0                          # '默认移动速度'
        self.Scan_Speed                  = 6000.0                          # '平扫移动速度'
        self.MinFocusCount               = 6                               # '最小定焦点位'
        self.FocusingCount               = 2                               # '定焦次数　　'
        self.FocalDistance               = -8000                           # '正常焦点间距'
        self.OilFocalDistance            = -8000                           # '有油焦点间距'
        self.FocusingOffset              = -8000                           # '定焦轴偏移量'
        self.ObjectiveOffset             = 1500000                         # '物镜轴偏移量'


        self.flushInfo()
        pass
    def initObjective20     (self):
        self.Information                 = '２０　倍物镜相机参数'
        self.Level                       = ObjectiveLevel.Objective20      # '物镜类型　　'
        self.LAMP                        = 200                             # '光源强度　　'
        self.APBL                        = 10                              # '孔径光阑　　'
        self.LFBL                        = 30                              # '视场光阑　　'
        self.Lower_Limit                 = 5000.0                          # '位置下限　　'
        self.Upper_Limit                 = 24800000.0                      # '位置上限　　'
        self.Focus_Lower_Limit           = 5000.0                          # '定焦位置下限'
        self.Focus_Upper_Limit           = 24800000.0                      # '定焦位置上限'
        self.Safe_Limit                  = 5000.0                          # '三次核型速度'
        self.Focus_Speed                 = 6000.0                          # '定焦移动速度'
        self.Default_Speed               = 6000.0                          # '默认移动速度'
        self.Scan_Speed                  = 6000.0                          # '平扫移动速度'
        self.MinFocusCount               = 6                               # '最小定焦点位'
        self.FocusingCount               = 2                               # '定焦次数　　'
        self.FocusingOffset              = 0                               # '定焦轴偏移量'
        self.FocalDistance               = -8000                           # '正常焦点间距'
        self.OilFocalDistance            = -8000                           # '有油焦点间距'
        self.FocusingOffset              = -8000                           # '定焦轴偏移量'
        self.ObjectiveOffset             = 1500000                         # '物镜轴偏移量'
        self.flushInfo()
        pass
    def initObjective40     (self):
        self.Information                 = '４０　倍物镜相机参数'              # '说明信息　　'
        self.Level                       = ObjectiveLevel.Objective40      # '物镜类型　　'
        self.LAMP                        =  200                            # '光源强度　　'
        self.APBL                        =  10                             # '孔径光阑　　'
        self.LFBL                        =  30                             # '视场光阑　　'
        self.Lower_Limit                 =  5000.0                         # '位置下限　　'
        self.Upper_Limit                 =  24800000.0                     # '位置上限　　'
        self.Focus_Lower_Limit           =  5000.0                         # '定焦位置下限'
        self.Focus_Upper_Limit           =  24800000.0                     # '定焦位置上限'
        self.Safe_Limit                  =  5000.0                         # '三次核型速度'
        self.Focus_Speed                 =  6000.0                         # '定焦移动速度'
        self.Default_Speed               =  6000.0                         # '默认移动速度'
        self.Scan_Speed                  =  6000.0                         # '平扫移动速度'
        self.MinFocusCount               =  6                              # '最小定焦点位'
        self.FocusingCount               =  2                              # '定焦次数　　'
        self.FocusingOffset              =  0                              # '定焦轴偏移量'
        self.FocalDistance               = -8000                           # '正常焦点间距'
        self.OilFocalDistance            = -8000                           # '有油焦点间距'
        self.FocusingOffset              = -8000                           # '定焦轴偏移量'
        self.ObjectiveOffset             = 1500000                         # '物镜轴偏移量'
        self.flushInfo()
        pass
    def initObjective63     (self):
        self.Information                 = '６３　倍物镜相机参数'              # '说明信息　　'
        self.Level                       = ObjectiveLevel.Objective63      # '物镜类型　　'
        self.LAMP                        =  200                            # '光源强度　　'
        self.APBL                        =  10                             # '孔径光阑　　'
        self.LFBL                        =  30                             # '视场光阑　　'
        self.Lower_Limit                 =  5000.0                         # '位置下限　　'
        self.Upper_Limit                 =  24800000.0                     # '位置上限　　'
        self.Focus_Lower_Limit           =  5000.0                         # '定焦位置下限'
        self.Focus_Upper_Limit           =  24800000.0                     # '定焦位置上限'
        self.Safe_Limit                  =  5000.0                         # '三次核型速度'
        self.Focus_Speed                 =  6000.0                         # '定焦移动速度'
        self.Default_Speed               =  6000.0                         # '默认移动速度'
        self.Scan_Speed                  =  6000.0                         # '平扫移动速度'
        self.MinFocusCount               =  6                              # '最小定焦点位'
        self.FocusingCount               =  2                              # '定焦次数　　'
        self.FocusingOffset              =  0                              # '定焦轴偏移量'
        self.FocalDistance               = -8000                           # '正常焦点间距'
        self.OilFocalDistance            = -8000                           # '有油焦点间距'
        self.FocusingOffset              = -8000                           # '定焦轴偏移量'
        self.ObjectiveOffset             = 1500000                         # '物镜轴偏移量'
        self.flushInfo()
        pass
    def initObjective100    (self):
        self.Information                 =  '１００倍物镜相机参数'             # '说明信息　　'
        self.Level                       =  ObjectiveLevel.Objective100    # '物镜类型　　'
        self.LAMP                        =  255                            # '光源强度　　'
        self.APBL                        =  16                             # '孔径光阑　　'
        self.LFBL                        =  33                             # '视场光阑　　'
        self.Lower_Limit                 =  5000.0                         # '位置下限　　'
        self.Upper_Limit                 =  24800000.0                     # '位置上限　　'
        self.Focus_Lower_Limit           =  5000.0                         # '定焦位置下限'
        self.Focus_Upper_Limit           =  24800000.0                     # '定焦位置上限'
        self.Safe_Limit                  =  5000.0                         # '三次核型速度'
        self.Focus_Speed                 =  6000.0                         # '定焦移动速度'
        self.Default_Speed               =  6000.0                         # '默认移动速度'
        self.Scan_Speed                  =  6000.0                         # '平扫移动速度'
        self.MinFocusCount               =  6                              # '最小定焦点位'
        self.FocusingCount               =  2                              # '定焦次数　　'
        self.FocusingOffset              =  0                              # '定焦轴偏移量'
        self.FocalDistance               = -8000                           # '正常焦点间距'
        self.OilFocalDistance            = -8000                           # '有油焦点间距'
        self.FocusingOffset              = -8000                           # '定焦轴偏移量'
        self.ObjectiveOffset             = 1500000                         # '物镜轴偏移量'
        self.flushInfo()
        pass
    def initObjectiveNone   (self):
        self.Information                 = '未知物镜相机参数　　'              # '说明信息　　'
        self.Level                       = ObjectiveLevel.ObjectiveNone    # '物镜类型　　'
        self.LAMP                        =  1                              # '光源强度　　'
        self.APBL                        =  10                             # '孔径光阑　　'
        self.LFBL                        =  30                             # '视场光阑　　'
        self.Lower_Limit                 =  5000.0                         # '位置下限　　'
        self.Upper_Limit                 =  24800000.0                     # '位置上限　　'
        self.Focus_Lower_Limit           =  5000.0                         # '定焦位置下限'
        self.Focus_Upper_Limit           =  24800000.0                     # '定焦位置上限'
        self.Safe_Limit                  =  5000.0                         # '三次核型速度'
        self.Focus_Speed                 =  6000.0                         # '定焦移动速度'
        self.Default_Speed               =  6000.0                         # '默认移动速度'
        self.Scan_Speed                  =  6000.0                         # '平扫移动速度'
        self.MinFocusCount               =  6                              # '最小定焦点位'
        self.FocusingCount               =  2                              # '定焦次数　　'
        self.FocusingOffset              =  0                              # '定焦轴偏移量'
        self.FocalDistance               = -8000                           # '正常焦点间距'
        self.OilFocalDistance            = -8000                           # '有油焦点间距'
        self.FocusingOffset              = -8000                           # '定焦轴偏移量'
        self.ObjectiveOffset             = 1500000                         # '物镜轴偏移量'
        self.flushInfo()


    @classmethod
    def initModels(cls) -> list:
        items: list[cls] = [
            cls.instance(Information      = '１　　倍物镜相机参数'    ,Level                      = ObjectiveLevel.Objective1          ,LAMP                        = 1          ,APBL                        = 10         ,LFBL                        = 30         ,Lower_Limit                 = 5000.0     ,Upper_Limit                 = 24800000.0 ,Focus_Lower_Limit           = 5000.0     ,Focus_Upper_Limit           = 24800000.0 ,Safe_Limit                  = 5000.0     ,ObjectiveOffset             = 1500000, Focus_Speed                 = 6000.0     ,Default_Speed               = 6000.0     ,Scan_Speed                  = 6000.0     ,MinFocusCount               = 6          ,FocusingCount               = 2          ,FocalDistance               = -8000      ,OilFocalDistance            = -8000      ,FocusingOffset              = -8000      ),
            cls.instance(Information      = '１０　倍物镜相机参数'    ,Level                      = ObjectiveLevel.Objective10         ,LAMP                        = 1          ,APBL                        = 10         ,LFBL                        = 30         ,Lower_Limit                 = 5000.0     ,Upper_Limit                 = 24800000.0 ,Focus_Lower_Limit           = 5000.0     ,Focus_Upper_Limit           = 24800000.0 ,Safe_Limit                  = 5000.0     ,ObjectiveOffset             = 1500000, Focus_Speed                 = 6000.0     ,Default_Speed               = 6000.0     ,Scan_Speed                  = 6000.0     ,MinFocusCount               = 6          ,FocusingCount               = 2          ,FocalDistance               = -8000      ,OilFocalDistance            = -8000      ,FocusingOffset              = -8000      ),
            cls.instance(Information      = '２０　倍物镜相机参数'    ,Level                      = ObjectiveLevel.Objective20         ,LAMP                        = 1          ,APBL                        = 10         ,LFBL                        = 30         ,Lower_Limit                 = 5000.0     ,Upper_Limit                 = 24800000.0 ,Focus_Lower_Limit           = 5000.0     ,Focus_Upper_Limit           = 24800000.0 ,Safe_Limit                  = 5000.0     ,ObjectiveOffset             = 1500000, Focus_Speed                 = 6000.0     ,Default_Speed               = 6000.0     ,Scan_Speed                  = 6000.0     ,MinFocusCount               = 6          ,FocusingCount               = 2          ,FocalDistance               = -8000      ,OilFocalDistance            = -8000      ,FocusingOffset              = -8000      ),
            cls.instance(Information      = '４０　倍物镜相机参数'    ,Level                      = ObjectiveLevel.Objective40         ,LAMP                        = 1          ,APBL                        = 10         ,LFBL                        = 30         ,Lower_Limit                 = 5000.0     ,Upper_Limit                 = 24800000.0 ,Focus_Lower_Limit           = 5000.0     ,Focus_Upper_Limit           = 24800000.0 ,Safe_Limit                  = 5000.0     ,ObjectiveOffset             = 1500000, Focus_Speed                 = 6000.0     ,Default_Speed               = 6000.0     ,Scan_Speed                  = 6000.0     ,MinFocusCount               = 6          ,FocusingCount               = 2          ,FocalDistance               = -8000      ,OilFocalDistance            = -8000      ,FocusingOffset              = -8000      ),
            cls.instance(Information      = '６３　倍物镜相机参数'    ,Level                      = ObjectiveLevel.Objective63         ,LAMP                        = 1          ,APBL                        = 10         ,LFBL                        = 30         ,Lower_Limit                 = 5000.0     ,Upper_Limit                 = 24800000.0 ,Focus_Lower_Limit           = 5000.0     ,Focus_Upper_Limit           = 24800000.0 ,Safe_Limit                  = 5000.0     ,ObjectiveOffset             = 1500000, Focus_Speed                 = 6000.0     ,Default_Speed               = 6000.0     ,Scan_Speed                  = 6000.0     ,MinFocusCount               = 6          ,FocusingCount               = 2          ,FocalDistance               = -8000      ,OilFocalDistance            = -8000      ,FocusingOffset              = -8000      ),
            cls.instance(Information      = '１００倍物镜相机参数'    ,Level                      = ObjectiveLevel.Objective100        ,LAMP                        = 1          ,APBL                        = 10         ,LFBL                        = 30         ,Lower_Limit                 = 5000.0     ,Upper_Limit                 = 24800000.0 ,Focus_Lower_Limit           = 5000.0     ,Focus_Upper_Limit           = 24800000.0 ,Safe_Limit                  = 5000.0     ,ObjectiveOffset             = 1500000, Focus_Speed                 = 6000.0     ,Default_Speed               = 6000.0     ,Scan_Speed                  = 6000.0     ,MinFocusCount               = 6          ,FocusingCount               = 2          ,FocalDistance               = -8000      ,OilFocalDistance            = -8000      ,FocusingOffset              = -8000      ),
            cls.instance(Information      = '未知物镜相机参数　　'    ,Level                      = ObjectiveLevel.ObjectiveNone       ,LAMP                        = 1          ,APBL                        = 10         ,LFBL                        = 30         ,Lower_Limit                 = 5000.0     ,Upper_Limit                 = 24800000.0 ,Focus_Lower_Limit           = 5000.0     ,Focus_Upper_Limit           = 24800000.0 ,Safe_Limit                  = 5000.0     ,ObjectiveOffset             = 1500000, Focus_Speed                 = 6000.0     ,Default_Speed               = 6000.0     ,Scan_Speed                  = 6000.0     ,MinFocusCount               = 6          ,FocusingCount               = 2          ,FocalDistance               = -8000      ,OilFocalDistance            = -8000      ,FocusingOffset              = -8000      ),
        ]

        return items


















    __field__ = (
        'Information'           ,
        'Level'                 ,
        'LAMP'                  ,
        'APBL'                  ,
        'LFBL'                  ,
        'Lower_Limit'           ,
        'Upper_Limit'           ,
        'Focus_Lower_Limit'     ,
        'Focus_Upper_Limit'     ,
        'Safe_Limit'            ,
        'Focus_Speed'           ,
        'Default_Speed'         ,
        'Scan_Speed'            ,
        'MinFocusCount'         ,
        'FocusingCount'         ,
        'FocalDistance'         ,
        'OilFocalDistance'      ,
        'FocusingOffset'        ,
    )
    __types__ = (
        str                     ,
        int                     ,
        float                   ,
        float                   ,
        float                   ,
        float                   ,
        float                   ,
        float                   ,
        float                   ,
        float                   ,
        float                   ,
        float                   ,
        float                   ,
        float                   ,
        float                   ,
        float                   ,
        float                   ,
        float                   ,

    )

    @property
    def has_Information                     (self) -> bool:
        return hasattr(self, 'Information'           ) and isinstance(self.Information                     , str)

    @property
    def has_Level                           (self) -> bool:
        return hasattr(self, 'Level'                 ) and isinstance(self.Level                           , (int, float))

    @property
    def has_LAMP                            (self) -> bool:
        return hasattr(self, 'LAMP'                  ) and isinstance(self.LAMP                            , (int, float))

    @property
    def has_APBL                            (self) -> bool:
        return hasattr(self, 'APBL'                  ) and isinstance(self.APBL                            , (int, float))

    @property
    def has_LFBL                            (self) -> bool:
        return hasattr(self, 'LFBL'                  ) and isinstance(self.LFBL                            , (int, float))

    @property
    def has_Lower_Limit                     (self) -> bool:
        return hasattr(self, 'Lower_Limit'           ) and isinstance(self.Lower_Limit                     , (int, float))

    @property
    def has_Upper_Limit                     (self) -> bool:
        return hasattr(self, 'Upper_Limit'           ) and isinstance(self.Upper_Limit                     , (int, float))

    @property
    def has_Focus_Lower_Limit               (self) -> bool:
        return hasattr(self, 'Focus_Lower_Limit'     ) and isinstance(self.Focus_Lower_Limit               , (int, float))

    @property
    def has_Focus_Upper_Limit               (self) -> bool:
        return hasattr(self, 'Focus_Upper_Limit'     ) and isinstance(self.Focus_Upper_Limit               , (int, float))

    @property
    def has_Safe_Limit                      (self) -> bool:
        return hasattr(self, 'Safe_Limit'            ) and isinstance(self.Safe_Limit                      , (int, float))

    @property
    def has_Focus_Speed                     (self) -> bool:
        return hasattr(self, 'Focus_Speed'           ) and isinstance(self.Focus_Speed                     , (int, float))

    @property
    def has_Default_Speed                   (self) -> bool:
        return hasattr(self, 'Default_Speed'         ) and isinstance(self.Default_Speed                   , (int, float))

    @property
    def has_Scan_Speed                      (self) -> bool:
        return hasattr(self, 'Scan_Speed'            ) and isinstance(self.Scan_Speed                      , (int, float))

    @property
    def has_MinFocusCount                   (self) -> bool:
        return hasattr(self, 'MinFocusCount'         ) and isinstance(self.MinFocusCount                   , (int, float))

    @property
    def has_FocusingCount                   (self) -> bool:
        return hasattr(self, 'FocusingCount'         ) and isinstance(self.FocusingCount                   , (int, float))

    @property
    def has_FocalDistance                   (self) -> bool:
        return hasattr(self, 'FocalDistance'         ) and isinstance(self.FocalDistance                   , (int, float))

    @property
    def has_OilFocalDistance                (self) -> bool:
        return hasattr(self, 'OilFocalDistance'      ) and isinstance(self.OilFocalDistance                , (int, float))

    @property
    def has_FocusingOffset                  (self) -> bool:
        return hasattr(self, 'FocusingOffset'        ) and isinstance(self.FocusingOffset                  , (int, float))
