from typing import TypedDict, Literal, NotRequired, Any, Coroutine, Union, overload, Generator
from hfortix_fortios.models import FortiObject

# Payload TypedDict for IDE autocomplete
class RipngPayload(TypedDict, total=False):
    """
    Type hints for router/ripng payload fields.
    
    Configure RIPng.
    
    **Usage:**
        payload: RipngPayload = {
            "field": "value",  # <- autocomplete shows all fields
        }
    """
    default_information_originate: NotRequired[Literal["enable", "disable"]]  # Enable/disable generation of default route.
    default_metric: NotRequired[int]  # Default metric.
    max_out_metric: NotRequired[int]  # Maximum metric allowed to output(0 means 'not set').
    distance: NotRequired[list[dict[str, Any]]]  # Distance.
    distribute_list: NotRequired[list[dict[str, Any]]]  # Distribute list.
    neighbor: NotRequired[list[dict[str, Any]]]  # Neighbor.
    network: NotRequired[list[dict[str, Any]]]  # Network.
    aggregate_address: NotRequired[list[dict[str, Any]]]  # Aggregate address.
    offset_list: NotRequired[list[dict[str, Any]]]  # Offset list.
    passive_interface: NotRequired[list[dict[str, Any]]]  # Passive interface configuration.
    redistribute: NotRequired[list[dict[str, Any]]]  # Redistribute configuration.
    update_timer: NotRequired[int]  # Update timer in seconds.
    timeout_timer: NotRequired[int]  # Timeout timer in seconds.
    garbage_timer: NotRequired[int]  # Garbage timer in seconds.
    interface: NotRequired[list[dict[str, Any]]]  # RIPng interface configuration.


class RipngObject(FortiObject[RipngPayload]):
    """Typed FortiObject for router/ripng with IDE autocomplete support."""
    
    # Enable/disable generation of default route.
    default_information_originate: Literal["enable", "disable"]
    # Default metric.
    default_metric: int
    # Maximum metric allowed to output(0 means 'not set').
    max_out_metric: int
    # Distance.
    distance: list[str]  # Auto-flattened from member_table
    # Distribute list.
    distribute_list: list[str]  # Auto-flattened from member_table
    # Neighbor.
    neighbor: list[str]  # Auto-flattened from member_table
    # Network.
    network: list[str]  # Auto-flattened from member_table
    # Aggregate address.
    aggregate_address: list[str]  # Auto-flattened from member_table
    # Offset list.
    offset_list: list[str]  # Auto-flattened from member_table
    # Passive interface configuration.
    passive_interface: list[str]  # Auto-flattened from member_table
    # Redistribute configuration.
    redistribute: list[str]  # Auto-flattened from member_table
    # Update timer in seconds.
    update_timer: int
    # Timeout timer in seconds.
    timeout_timer: int
    # Garbage timer in seconds.
    garbage_timer: int
    # RIPng interface configuration.
    interface: list[str]  # Auto-flattened from member_table
    
    # Methods inherited from FortiObject
    def get_full(self, name: str) -> Any: ...
    def to_dict(self) -> RipngPayload: ...
    def keys(self) -> Any: ...
    def values(self) -> Generator[Any, None, None]: ...
    def items(self) -> Generator[tuple[str, Any], None, None]: ...
    def get(self, key: str, default: Any = None) -> Any: ...


class Ripng:
    """
    Configure RIPng.
    
    Path: router/ripng
    Category: cmdb
    """
    
    # Overloads for get() with response_mode="object"
    @overload
    def get(
        self,
        name: str | None = ...,
        filter: list[str] | None = ...,
        count: int | None = ...,
        start: int | None = ...,
        payload_dict: dict[str, Any] | None = ...,
        range: list[int] | None = ...,
        sort: str | None = ...,
        format: str | None = ...,
        action: str | None = ...,
        vdom: str | bool | None = ...,
        raw_json: Literal[False] = ...,
        response_mode: Literal["object"] = ...,
        **kwargs: Any,
    ) -> list[RipngObject]: ...
    
    @overload
    def get(
        self,
        name: str,
        filter: list[str] | None = ...,
        count: int | None = ...,
        start: int | None = ...,
        payload_dict: dict[str, Any] | None = ...,
        range: list[int] | None = ...,
        sort: str | None = ...,
        format: str | None = ...,
        action: str | None = ...,
        vdom: str | bool | None = ...,
        raw_json: Literal[False] = ...,
        response_mode: Literal["object"] = ...,
        **kwargs: Any,
    ) -> RipngObject: ...
    
    @overload
    def get(
        self,
        name: str | None = ...,
        filter: list[str] | None = ...,
        count: int | None = ...,
        start: int | None = ...,
        payload_dict: dict[str, Any] | None = ...,
        range: list[int] | None = ...,
        sort: str | None = ...,
        format: str | None = ...,
        action: str | None = ...,
        vdom: str | bool | None = ...,
        raw_json: Literal[True] = ...,
        response_mode: Literal["object"] = ...,
        **kwargs: Any,
    ) -> dict[str, Any]: ...
    
    # Default overload for dict mode
    @overload
    def get(
        self,
        name: str | None = ...,
        filter: list[str] | None = ...,
        count: int | None = ...,
        start: int | None = ...,
        payload_dict: dict[str, Any] | None = ...,
        range: list[int] | None = ...,
        sort: str | None = ...,
        format: str | None = ...,
        action: str | None = ...,
        vdom: str | bool | None = ...,
        raw_json: bool = ...,
        response_mode: Literal["dict"] | None = ...,
        **kwargs: Any,
    ) -> Union[dict[str, Any], list[dict[str, Any]]]: ...
    
    def get(
        self,
        name: str | None = ...,
        filter: list[str] | None = ...,
        count: int | None = ...,
        start: int | None = ...,
        payload_dict: dict[str, Any] | None = ...,
        range: list[int] | None = ...,
        sort: str | None = ...,
        format: str | None = ...,
        action: str | None = ...,
        vdom: str | bool | None = ...,
        raw_json: bool = ...,
        response_mode: str | None = ...,
        **kwargs: Any,
    ) -> Union[dict[str, Any], list[dict[str, Any]], RipngObject, list[RipngObject]]: ...
    
    def get_schema(
        self,
        vdom: str | None = ...,
        format: str = ...,
    ) -> Union[dict[str, Any], Coroutine[Any, Any, dict[str, Any]]]: ...
    
    def post(
        self,
        payload_dict: RipngPayload | None = ...,
        default_information_originate: Literal["enable", "disable"] | None = ...,
        default_metric: int | None = ...,
        max_out_metric: int | None = ...,
        distance: str | None = ...,
        distribute_list: str | None = ...,
        neighbor: str | None = ...,
        network: str | None = ...,
        aggregate_address: str | None = ...,
        offset_list: str | None = ...,
        passive_interface: str | None = ...,
        redistribute: str | None = ...,
        update_timer: int | None = ...,
        timeout_timer: int | None = ...,
        garbage_timer: int | None = ...,
        interface: str | 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: RipngPayload | None = ...,
        default_information_originate: Literal["enable", "disable"] | None = ...,
        default_metric: int | None = ...,
        max_out_metric: int | None = ...,
        distance: str | None = ...,
        distribute_list: str | None = ...,
        neighbor: str | None = ...,
        network: str | None = ...,
        aggregate_address: str | None = ...,
        offset_list: str | None = ...,
        passive_interface: str | None = ...,
        redistribute: str | None = ...,
        update_timer: int | None = ...,
        timeout_timer: int | None = ...,
        garbage_timer: int | None = ...,
        interface: str | 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: RipngPayload | 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__ = [
    "Ripng",
    "RipngPayload",
    "RipngObject",
]