from __future__ import annotations
from typing import Protocol, Iterator, Any, runtime_checkable, TYPE_CHECKING
from zempy.zosapi.application.directories import Directories
from zempy.zosapi.enums.license_status import LicenseStatusType
if TYPE_CHECKING:
    from zempy.zosapi.system.protocols.IOpticalSystem import IOpticalSystem

@runtime_checkable
class IApplication(Protocol):
    # ---- lifecycle ----
    def close(self) -> None: ...
    @property
    def is_closed(self) -> bool: ...

    # ---- licensing / version ----
    @property
    def is_valid_license(self) -> bool: ...
    @property
    def license_status(self) -> LicenseStatusType:...
    @property
    def version(self) -> tuple[int, int, int]: ...
    @property
    def opticstudio_version_int(self) -> int: ...
    @property
    def date_string(self) -> str: ...


    @property
    def paths(self) -> Directories: ...

    @property
    def n_systems(self) -> int: ...
    @property
    def primary(self) -> IOpticalSystem: ...
    def systems(self) -> Iterator[IOpticalSystem]: ...
    def get_system(self, index: int) -> IOpticalSystem: ...
    def close_system(self, index: int, *, save_if_needed: bool = False) -> bool: ...
    def load_lens(self, lens_file: str) -> IOpticalSystem: ...
    def create_system(self, system_type: Any) -> IOpticalSystem: ...
    def update_file_lists(self) -> None: ...


    def check_for_updates(self) -> None: ...
    @property
    def check_updates_status(self) -> Any: ...
    @property
    def check_updates_version(self) -> int: ...
    @property
    def check_updates_data(self) -> str: ...

    # ---- plugin/UI progress ----
    @property
    def show_changes_in_ui(self) -> bool: ...
    @show_changes_in_ui.setter
    def show_changes_in_ui(self, value: bool) -> None: ...
    @property
    def progress_message(self) -> str: ...
    @progress_message.setter
    def progress_message(self, msg: str) -> None: ...
    @property
    def progress_percent(self) -> float: ...
    @progress_percent.setter
    def progress_percent(self, pct: float) -> None: ...

    # ---- message log ----
    def clear_message_log(self) -> None: ...
    def begin_message_logging(self) -> bool: ...
    def end_message_logging(self) -> bool: ...
    def retrieve_log_messages(self) -> str: ...

    # ---- diagnostics ----
    def run_command(self, command: str) -> str: ...
