# Generated by generate_stubs.py (Python 3.14)
import uuid
from typing import Any, Self

from kafka.protocol.api_message import ApiMessage
from kafka.protocol.data_container import DataContainer

__all__ = ['MetadataRequest', 'MetadataResponse']

class MetadataRequest(ApiMessage):
    class MetadataRequestTopic(DataContainer):
        topic_id: uuid.UUID
        name: str | None
        def __init__(
            self,
            *args: Any,
            topic_id: uuid.UUID = ...,
            name: str | None = ...,
            version: int | None = None,
            **kwargs: Any,
        ) -> None: ...
        @property
        def version(self) -> int | None: ...
        def to_dict(self, meta: bool = False, json: bool = True) -> dict: ...

    topics: list[MetadataRequestTopic] | None
    allow_auto_topic_creation: bool
    include_cluster_authorized_operations: bool
    include_topic_authorized_operations: bool
    def __init__(
        self,
        *args: Any,
        topics: list[MetadataRequestTopic] | None = ...,
        allow_auto_topic_creation: bool = ...,
        include_cluster_authorized_operations: bool = ...,
        include_topic_authorized_operations: bool = ...,
        version: int | None = None,
        **kwargs: Any,
    ) -> None: ...
    @property
    def version(self) -> int | None: ...
    def to_dict(self, meta: bool = False, json: bool = True) -> dict: ...
    name: str
    type: str
    API_KEY: int
    API_VERSION: int
    valid_versions: tuple[int, int]
    min_version: int
    max_version: int
    @property
    def header(self) -> Any: ...
    @classmethod
    def is_request(cls) -> bool: ...
    def expect_response(self) -> bool: ...
    def with_header(self, correlation_id: int = 0, client_id: str = "kafka-python") -> None: ...

class MetadataResponse(ApiMessage):
    class MetadataResponseBroker(DataContainer):
        node_id: int
        host: str
        port: int
        rack: str | None
        def __init__(
            self,
            *args: Any,
            node_id: int = ...,
            host: str = ...,
            port: int = ...,
            rack: str | None = ...,
            version: int | None = None,
            **kwargs: Any,
        ) -> None: ...
        @property
        def version(self) -> int | None: ...
        def to_dict(self, meta: bool = False, json: bool = True) -> dict: ...

    class MetadataResponseTopic(DataContainer):
        class MetadataResponsePartition(DataContainer):
            error_code: int
            partition_index: int
            leader_id: int
            leader_epoch: int
            replica_nodes: list[int]
            isr_nodes: list[int]
            offline_replicas: list[int]
            def __init__(
                self,
                *args: Any,
                error_code: int = ...,
                partition_index: int = ...,
                leader_id: int = ...,
                leader_epoch: int = ...,
                replica_nodes: list[int] = ...,
                isr_nodes: list[int] = ...,
                offline_replicas: list[int] = ...,
                version: int | None = None,
                **kwargs: Any,
            ) -> None: ...
            @property
            def version(self) -> int | None: ...
            def to_dict(self, meta: bool = False, json: bool = True) -> dict: ...

        error_code: int
        name: str | None
        topic_id: uuid.UUID
        is_internal: bool
        partitions: list[MetadataResponsePartition]
        authorized_operations: set[int]
        def __init__(
            self,
            *args: Any,
            error_code: int = ...,
            name: str | None = ...,
            topic_id: uuid.UUID = ...,
            is_internal: bool = ...,
            partitions: list[MetadataResponsePartition] = ...,
            authorized_operations: set[int] = ...,
            version: int | None = None,
            **kwargs: Any,
        ) -> None: ...
        @property
        def version(self) -> int | None: ...
        def to_dict(self, meta: bool = False, json: bool = True) -> dict: ...

    throttle_time_ms: int
    brokers: list[MetadataResponseBroker]
    cluster_id: str | None
    controller_id: int
    topics: list[MetadataResponseTopic]
    authorized_operations: set[int]
    error_code: int
    def __init__(
        self,
        *args: Any,
        throttle_time_ms: int = ...,
        brokers: list[MetadataResponseBroker] = ...,
        cluster_id: str | None = ...,
        controller_id: int = ...,
        topics: list[MetadataResponseTopic] = ...,
        authorized_operations: set[int] = ...,
        error_code: int = ...,
        version: int | None = None,
        **kwargs: Any,
    ) -> None: ...
    @property
    def version(self) -> int | None: ...
    def to_dict(self, meta: bool = False, json: bool = True) -> dict: ...
    name: str
    type: str
    API_KEY: int
    API_VERSION: int
    valid_versions: tuple[int, int]
    min_version: int
    max_version: int
    @property
    def header(self) -> Any: ...
    @classmethod
    def is_request(cls) -> bool: ...
    def expect_response(self) -> bool: ...
    def with_header(self, correlation_id: int = 0, client_id: str = "kafka-python") -> None: ...
