from typing import TypedDict, Literal, NotRequired, Any, Coroutine, Union

# Payload TypedDict for IDE autocomplete
class StpSettingsPayload(TypedDict, total=False):
    """
    Type hints for switch_controller/stp_settings payload fields.
    
    Use this for IDE autocomplete when building payload dicts:
        payload: StpSettingsPayload = {
            "field": "value",  # <- autocomplete shows all fields
        }
    """
    name: NotRequired[str]  # Name of global STP settings configuration.
    revision: NotRequired[int]  # STP revision number (0 - 65535).
    hello_time: NotRequired[int]  # Period of time between successive STP frame Bridge Protocol 
    forward_time: NotRequired[int]  # Period of time a port is in listening and learning state (4 
    max_age: NotRequired[int]  # Maximum time before a bridge port expires its configuration 
    max_hops: NotRequired[int]  # Maximum number of hops between the root bridge and the furth
    pending_timer: NotRequired[int]  # Pending time (1 - 15 sec, default = 4).


class StpSettings:
    """
    Configure FortiSwitch spanning tree protocol (STP).
    
    Path: switch_controller/stp_settings
    Category: cmdb
    """
    
    def get(
        self,
        name: str | None = ...,
        filter: str | None = ...,
        range: list[int] | None = ...,
        sort: str | None = ...,
        format: str | None = ...,
        action: str | None = ...,
        vdom: str | bool | None = ...,
        raw_json: bool = ...,
        **kwargs: Any,
    ) -> Union[dict[str, Any], Coroutine[Any, Any, dict[str, Any]]]: ...
    
    def post(
        self,
        payload_dict: StpSettingsPayload | None = ...,
        name: str | None = ...,
        revision: int | None = ...,
        hello_time: int | None = ...,
        forward_time: int | None = ...,
        max_age: int | None = ...,
        max_hops: int | None = ...,
        pending_timer: int | None = ...,
        vdom: str | bool | None = ...,
        raw_json: bool = ...,
        **kwargs: Any,
    ) -> Union[dict[str, Any], Coroutine[Any, Any, dict[str, Any]]]: ...
    
    def put(
        self,
        payload_dict: StpSettingsPayload | None = ...,
        name: str | None = ...,
        revision: int | None = ...,
        hello_time: int | None = ...,
        forward_time: int | None = ...,
        max_age: int | None = ...,
        max_hops: int | None = ...,
        pending_timer: int | None = ...,
        vdom: str | bool | None = ...,
        raw_json: bool = ...,
        **kwargs: Any,
    ) -> Union[dict[str, Any], Coroutine[Any, Any, dict[str, Any]]]: ...
    
    def delete(
        self,
        name: str | None = ...,
        vdom: str | bool | None = ...,
        raw_json: bool = ...,
        **kwargs: Any,
    ) -> Union[dict[str, Any], Coroutine[Any, Any, dict[str, Any]]]: ...
    
    def exists(
        self,
        name: str,
        vdom: str | bool | None = ...,
    ) -> Union[bool, Coroutine[Any, Any, bool]]: ...
    
    def set(
        self,
        payload_dict: StpSettingsPayload | None = ...,
        vdom: str | bool | None = ...,
        **kwargs: Any,
    ) -> Union[dict[str, Any], Coroutine[Any, Any, dict[str, Any]]]: ...
    
    # Helper methods
    @staticmethod
    def help(field_name: str | None = ...) -> str: ...
    
    @staticmethod
    def fields(detailed: bool = ...) -> Union[list[str], list[dict[str, Any]]]: ...
    
    @staticmethod
    def field_info(field_name: str) -> dict[str, Any]: ...
    
    @staticmethod
    def validate_field(name: str, value: Any) -> bool: ...
    
    @staticmethod
    def required_fields() -> list[str]: ...
    
    @staticmethod
    def defaults() -> dict[str, Any]: ...
    
    @staticmethod
    def schema() -> dict[str, Any]: ...


__all__ = [
    "StpSettings",
    "StpSettingsPayload",
]