import abc
import threading
from _typeshed import Incomplete
from typing import ClassVar

from kafka import errors as Errors

log: Incomplete
heartbeat_log: Incomplete

class MemberState:
    UNJOINED: str
    REBALANCING: str
    STABLE: str

class Generation:
    NO_GENERATION: ClassVar[Generation]
    generation_id: Incomplete
    member_id: Incomplete
    protocol: Incomplete
    def __init__(self, generation_id, member_id, protocol) -> None: ...
    def has_member_id(self): ...
    def __eq__(self, other): ...

class UnjoinedGroupException(Errors.KafkaError):
    retriable: bool

class BaseCoordinator(metaclass=abc.ABCMeta):
    DEFAULT_CONFIG: Incomplete
    config: Incomplete
    heartbeat: Incomplete
    rejoin_needed: bool
    rejoining: bool
    state: Incomplete
    join_future: Incomplete
    coordinator_id: Incomplete
    def __init__(self, client, **configs) -> None: ...
    @property
    def group_id(self): ...
    @property
    def group_instance_id(self): ...
    @abc.abstractmethod
    def protocol_type(self): ...
    @abc.abstractmethod
    def group_protocols(self): ...
    def coordinator_unknown(self): ...
    def coordinator(self): ...
    def connected(self): ...
    def ensure_coordinator_ready(self, timeout_ms=None): ...
    def lookup_coordinator(self): ...
    def need_rejoin(self): ...
    def poll_heartbeat(self) -> None: ...
    def time_to_next_heartbeat(self): ...
    def ensure_active_group(self, timeout_ms=None): ...
    def join_group(self, timeout_ms=None): ...
    def coordinator_dead(self, error) -> None: ...
    def generation_if_stable(self): ...
    def generation(self): ...
    def rebalance_in_progress(self): ...
    def reset_generation(self, member_id="") -> None: ...
    def request_rejoin(self) -> None: ...
    def __del__(self) -> None: ...
    def close(self, timeout_ms=None) -> None: ...
    def is_dynamic_member(self): ...
    def maybe_leave_group(self, timeout_ms=None) -> None: ...

class GroupCoordinatorMetrics:
    heartbeat: Incomplete
    metrics: Incomplete
    metric_group_name: Incomplete
    heartbeat_latency: Incomplete
    join_latency: Incomplete
    sync_latency: Incomplete
    def __init__(self, heartbeat, metrics, prefix, tags=None) -> None: ...

class HeartbeatThread(threading.Thread):
    name: Incomplete
    coordinator: Incomplete
    enabled: bool
    closed: bool
    failed: Incomplete
    def __init__(self, coordinator) -> None: ...
    def enable(self) -> None: ...
    def disable(self) -> None: ...
    def close(self, timeout_ms=None) -> None: ...
    def run(self) -> None: ...
