from __future__ import annotations
from typing import Protocol, runtime_checkable, Any, Iterable, Sequence, Optional
from zempy.zosapi.tools.general.protocols.i_quick_focus import IQuickFocus
from zempy.zosapi.tools.raytrace.protocols.i_batch_ray_trace import IBatchRayTrace


INSCRayTrace = Any
IQuickAdjust = Any

ILightningTrace = Any
IFindBestAsphere = Any
IConvertAsphereType = Any
ILocalOptimization = Any
IGlobalOptimization = Any
IHammerOptimization = Any
ITolerancing = Any
IRestoreArchive = Any
ICreateArchive = Any
IRestoreProject = Any
ICreateProject = Any
IExportCAD = Any
IScale = Any
IMFCalculator = Any
ILensCatalogs = Any
IConvertToNSCGroup = Any
IDesignLockdown = Any
ICriticalRaysetGenerator = Any
IZRDReader = Any
IComputeRMSSpotSize = Any
IShadedModelVisualizationExport = Any
IMaterialsCatalog = Any
IQuickSensitivity = Any
IToleranceDataViewer = Any
IRayAimingWizard = Any
IHPCSettings = Any
IPointTools = Any
IHullTools = Any
IFileManager = Any
IConvertProjectToFileTool = Any
IExportToSpeosLensSystem = Any
IExportToSpeosWhitebox = Any
IAPIUtilities = Any
ISystemTool = Any
ILayouts = Any
IMessage = Any
ZemaxSystemUnits = Any
HPCNodeSize = Any


@runtime_checkable
class IOpticalSystemTools(Protocol):
    """Protocol mirroring ZOSAPI.Tools.IOpticalSystemTools (PascalCase).

    Note: Only one ISystemTool can be open at a time; close it via ISystemTool.Close()
    before opening another.
    """

    # -------- Public Member Functions --------
    def OpenBatchRayTrace(self) -> IBatchRayTrace: ...
    def OpenNSCRayTrace(self) -> INSCRayTrace: ...
    def OpenQuickAdjust(self) -> IQuickAdjust: ...
    def OpenQuickFocus(self) -> IQuickFocus: ...
    def OpenLightningTrace(self) -> ILightningTrace: ...
    def OpenFindBestAsphere(self) -> IFindBestAsphere: ...
    def OpenConvertAsphereTypes(self) -> IConvertAsphereType: ...
    def OpenLocalOptimization(self) -> ILocalOptimization: ...
    def OpenGlobalOptimization(self) -> IGlobalOptimization: ...
    def OpenHammerOptimization(self) -> IHammerOptimization: ...
    def OpenTolerancing(self) -> ITolerancing: ...
    def OpenRestoreZAR(self) -> IRestoreArchive: ...
    def OpenCreateZAR(self) -> ICreateArchive: ...
    def OpenRestoreProject(self) -> IRestoreProject: ...
    def OpenCreateProject(self) -> ICreateProject: ...
    def OpenExportCAD(self) -> IExportCAD: ...
    def OpenScale(self) -> IScale: ...
    def OpenMeritFunctionCalculator(self) -> IMFCalculator: ...
    def OpenLensCatalogs(self) -> ILensCatalogs: ...
    def OpenConvertToNSCGroup(self) -> IConvertToNSCGroup: ...
    def OpenDesignLockdown(self) -> IDesignLockdown: ...
    def OpenCriticalRaysetGenerator(self) -> ICriticalRaysetGenerator: ...
    def RemoveAllVariables(self) -> bool: ...
    def SetAllRadiiVariable(self) -> int: ...
    def SetAllThicknessesVariable(self) -> int: ...
    def CreateDoubleVector(self, numElements: int) -> Sequence[float]: ...
    def CreateDoubleMatrix(self, Rows: int, Cols: int) -> Iterable[Iterable[float]]: ...
    def OpenRayDatabaseReader(self) -> IZRDReader: ...
    def OpenRMSSpotRadiusCalculator(self) -> IComputeRMSSpotSize: ...
    def GetConversionToSystemUnits(self, fromUnits: ZemaxSystemUnits) -> float: ...
    def GetConversionFromSystemUnits(self, toUnits: ZemaxSystemUnits) -> float: ...
    def OpenShadedModelVisualizationExport(self) -> IShadedModelVisualizationExport: ...
    def OpenMaterialsCatalog(self) -> IMaterialsCatalog: ...
    def OpenQuickSensitivity(self) -> IQuickSensitivity: ...
    def OpenToleranceDataViewer(self) -> IToleranceDataViewer: ...
    def OpenRayAimingWizard(self) -> IRayAimingWizard: ...
    def GetHPCSettingsFromPrefs(self) -> IHPCSettings: ...
    def GetHPCSettingsCustom(self, nodeCount: int, instanceType: HPCNodeSize) -> IHPCSettings: ...
    def OpenNSCRayTrace_HPC(self, hpcSettings: IHPCSettings) -> INSCRayTrace: ...
    def OpenTolerancing_HPC(self, hpcSettings: IHPCSettings) -> ITolerancing: ...
    def OpenGlobalOptimization_HPC(self, hpcSettings: IHPCSettings) -> IGlobalOptimization: ...
    def OpenHammerOptimization_HPC(self, hpcSettings: IHPCSettings) -> IHammerOptimization: ...
    def GetPointTools(self) -> IPointTools: ...
    def GetHullTools(self) -> IHullTools: ...
    def OpenFileManager(self) -> IFileManager: ...
    def OpenProjectToFileConverter(self) -> IConvertProjectToFileTool: ...
    def OpenExportToSpeosLensSystem(self) -> IExportToSpeosLensSystem: ...
    def OpenExportToSpeosWhitebox(self) -> IExportToSpeosWhitebox: ...
    def GetUtilities(self) -> IAPIUtilities: ...

    # -------- Properties --------
    @property
    def CurrentTool(self) -> Optional[ISystemTool]: ...

    @property
    def Progress(self) -> int: ...

    @property
    def Status(self) -> str: ...

    @property
    def IsRunning(self) -> bool: ...

    @property
    def Layouts(self) -> ILayouts: ...

    @property
    def LastError(self) -> IMessage: ...
