"""
Generated from ``clients/src/main/resources/common/message/ShareGroupHeartbeatRequest.json``.
"""

from dataclasses import dataclass
from dataclasses import field
from typing import ClassVar

from kio.schema.request_header.v2.header import RequestHeader
from kio.schema.types import GroupId
from kio.static.constants import EntityType
from kio.static.primitive import i16
from kio.static.primitive import i32


@dataclass(frozen=True, slots=True, kw_only=True)
class ShareGroupHeartbeatRequest:
    __type__: ClassVar = EntityType.request
    __version__: ClassVar[i16] = i16(0)
    __flexible__: ClassVar[bool] = True
    __api_key__: ClassVar[i16] = i16(76)
    __header_schema__: ClassVar[type[RequestHeader]] = RequestHeader
    group_id: GroupId = field(metadata={"kafka_type": "string"})
    """The group identifier."""
    member_id: str = field(metadata={"kafka_type": "string"})
    """The member ID generated by the coordinator. The member ID must be kept during the entire lifetime of the member."""
    member_epoch: i32 = field(metadata={"kafka_type": "int32"})
    """The current member epoch; 0 to join the group; -1 to leave the group."""
    rack_id: str | None = field(metadata={"kafka_type": "string"}, default=None)
    """null if not provided or if it didn't change since the last heartbeat; the rack ID of consumer otherwise."""
    subscribed_topic_names: tuple[str, ...] = field(
        metadata={"kafka_type": "string"}, default=()
    )
    """null if it didn't change since the last heartbeat; the subscribed topic names otherwise."""
