from typing import Any, Mapping, Optional, Set, Tuple

from bson.objectid import ObjectId
from pymongo.ismaster import IsMaster

_Address = Tuple[str, Optional[int]]

class ServerDescription:
    def __init__(
        self,
        address: _Address,
        ismaster: Optional[IsMaster] = ...,
        round_trip_time: Optional[float] = ...,
        error: Optional[Exception] = ...,
    ) -> None: ...
    @property
    def address(self) -> _Address: ...
    @property
    def server_type(self) -> int: ...
    @property
    def server_type_name(self) -> str: ...
    @property
    def all_hosts(self) -> Set[Tuple[str, int]]: ...
    @property
    def tags(self) -> Mapping[str, Any]: ...
    @property
    def replica_set_name(self) -> Optional[str]: ...
    @property
    def primary(self) -> Optional[Tuple[str, int]]: ...
    @property
    def max_bson_size(self) -> int: ...
    @property
    def max_message_size(self) -> int: ...
    @property
    def max_write_batch_size(self) -> int: ...
    @property
    def min_wire_version(self) -> int: ...
    @property
    def max_wire_version(self) -> int: ...
    @property
    def set_version(self) -> Optional[int]: ...
    @property
    def election_id(self) -> Optional[ObjectId]: ...
    @property
    def cluster_time(self) -> Optional[Mapping[str, Any]]: ...
    @property
    def election_tuple(self) -> Tuple[Optional[int], Optional[ObjectId]]: ...
    @property
    def me(self) -> Optional[Tuple[str, int]]: ...
    @property
    def logical_session_timeout_minutes(self) -> Optional[int]: ...
    @property
    def last_write_date(self) -> Optional[float]: ...
    @property
    def last_update_time(self) -> float: ...
    @property
    def round_trip_time(self) -> Optional[float]: ...
    @property
    def error(self) -> Optional[Exception]: ...
    @property
    def is_writable(self) -> bool: ...
    @property
    def is_readable(self) -> bool: ...
    @property
    def mongos(self) -> bool: ...
    @property
    def is_server_type_known(self) -> bool: ...
    @property
    def retryable_writes_supported(self) -> bool: ...
    @property
    def retryable_reads_supported(self) -> bool: ...
    @property
    def topology_version(self) -> Optional[Mapping[str, Any]]: ...
    def to_unknown(self, error: Optional[Exception] = ...) -> ServerDescription: ...
    def __eq__(self, other: Any) -> bool: ...
    def __ne__(self, other: Any) -> bool: ...
