"""
@generated by mypy-protobuf.  Do not edit manually!
isort:skip_file
"""

import builtins
import collections.abc
import google.protobuf.descriptor
import google.protobuf.internal.containers
import google.protobuf.internal.enum_type_wrapper
import google.protobuf.message
import sys
import typing

if sys.version_info >= (3, 10):
    import typing as typing_extensions
else:
    import typing_extensions

DESCRIPTOR: google.protobuf.descriptor.FileDescriptor

@typing.final
class Message(google.protobuf.message.Message):
    """Bitswap message format supporting v1.0.0, v1.1.0, and v1.2.0
    Based on https://specs.ipfs.tech/bitswap-protocol/
    """

    DESCRIPTOR: google.protobuf.descriptor.Descriptor

    class _BlockPresenceType:
        ValueType = typing.NewType("ValueType", builtins.int)
        V: typing_extensions.TypeAlias = ValueType

    class _BlockPresenceTypeEnumTypeWrapper(google.protobuf.internal.enum_type_wrapper._EnumTypeWrapper[Message._BlockPresenceType.ValueType], builtins.type):
        DESCRIPTOR: google.protobuf.descriptor.EnumDescriptor
        Have: Message._BlockPresenceType.ValueType  # 0
        DontHave: Message._BlockPresenceType.ValueType  # 1

    class BlockPresenceType(_BlockPresenceType, metaclass=_BlockPresenceTypeEnumTypeWrapper):
        """v1.2.0: BlockPresence for Have/DontHave responses"""

    Have: Message.BlockPresenceType.ValueType  # 0
    DontHave: Message.BlockPresenceType.ValueType  # 1

    @typing.final
    class Wantlist(google.protobuf.message.Message):
        DESCRIPTOR: google.protobuf.descriptor.Descriptor

        class _WantType:
            ValueType = typing.NewType("ValueType", builtins.int)
            V: typing_extensions.TypeAlias = ValueType

        class _WantTypeEnumTypeWrapper(google.protobuf.internal.enum_type_wrapper._EnumTypeWrapper[Message.Wantlist._WantType.ValueType], builtins.type):
            DESCRIPTOR: google.protobuf.descriptor.EnumDescriptor
            Block: Message.Wantlist._WantType.ValueType  # 0
            """Request the full block"""
            Have: Message.Wantlist._WantType.ValueType  # 1
            """Request only if peer has the block"""

        class WantType(_WantType, metaclass=_WantTypeEnumTypeWrapper):
            """v1.2.0: WantType enum"""

        Block: Message.Wantlist.WantType.ValueType  # 0
        """Request the full block"""
        Have: Message.Wantlist.WantType.ValueType  # 1
        """Request only if peer has the block"""

        @typing.final
        class Entry(google.protobuf.message.Message):
            DESCRIPTOR: google.protobuf.descriptor.Descriptor

            BLOCK_FIELD_NUMBER: builtins.int
            PRIORITY_FIELD_NUMBER: builtins.int
            CANCEL_FIELD_NUMBER: builtins.int
            WANTTYPE_FIELD_NUMBER: builtins.int
            SENDDONTHAVE_FIELD_NUMBER: builtins.int
            block: builtins.bytes
            """CID of the block (CIDv0 in v1.0.0, CIDv0/v1 in v1.1.0+)"""
            priority: builtins.int
            """the priority (normalized). default to 1"""
            cancel: builtins.bool
            """whether this revokes an entry"""
            wantType: global___Message.Wantlist.WantType.ValueType
            """v1.2.0: Block or Have. default to Block (0)"""
            sendDontHave: builtins.bool
            """v1.2.0: whether to send DontHave if block not found. default to false"""
            def __init__(
                self,
                *,
                block: builtins.bytes = ...,
                priority: builtins.int = ...,
                cancel: builtins.bool = ...,
                wantType: global___Message.Wantlist.WantType.ValueType = ...,
                sendDontHave: builtins.bool = ...,
            ) -> None: ...
            def ClearField(self, field_name: typing.Literal["block", b"block", "cancel", b"cancel", "priority", b"priority", "sendDontHave", b"sendDontHave", "wantType", b"wantType"]) -> None: ...

        ENTRIES_FIELD_NUMBER: builtins.int
        FULL_FIELD_NUMBER: builtins.int
        full: builtins.bool
        """whether this is the full wantlist. default to false"""
        @property
        def entries(self) -> google.protobuf.internal.containers.RepeatedCompositeFieldContainer[global___Message.Wantlist.Entry]:
            """a list of wantlist entries"""

        def __init__(
            self,
            *,
            entries: collections.abc.Iterable[global___Message.Wantlist.Entry] | None = ...,
            full: builtins.bool = ...,
        ) -> None: ...
        def ClearField(self, field_name: typing.Literal["entries", b"entries", "full", b"full"]) -> None: ...

    @typing.final
    class Block(google.protobuf.message.Message):
        """v1.1.0: Block message with CID prefix"""

        DESCRIPTOR: google.protobuf.descriptor.Descriptor

        PREFIX_FIELD_NUMBER: builtins.int
        DATA_FIELD_NUMBER: builtins.int
        prefix: builtins.bytes
        """CID prefix (all CID components except the digest of the multihash)"""
        data: builtins.bytes
        """block data"""
        def __init__(
            self,
            *,
            prefix: builtins.bytes = ...,
            data: builtins.bytes = ...,
        ) -> None: ...
        def ClearField(self, field_name: typing.Literal["data", b"data", "prefix", b"prefix"]) -> None: ...

    @typing.final
    class BlockPresence(google.protobuf.message.Message):
        DESCRIPTOR: google.protobuf.descriptor.Descriptor

        CID_FIELD_NUMBER: builtins.int
        TYPE_FIELD_NUMBER: builtins.int
        cid: builtins.bytes
        """CID of the block"""
        type: global___Message.BlockPresenceType.ValueType
        """Have or DontHave"""
        def __init__(
            self,
            *,
            cid: builtins.bytes = ...,
            type: global___Message.BlockPresenceType.ValueType = ...,
        ) -> None: ...
        def ClearField(self, field_name: typing.Literal["cid", b"cid", "type", b"type"]) -> None: ...

    WANTLIST_FIELD_NUMBER: builtins.int
    BLOCKS_FIELD_NUMBER: builtins.int
    PAYLOAD_FIELD_NUMBER: builtins.int
    BLOCKPRESENCES_FIELD_NUMBER: builtins.int
    PENDINGBYTES_FIELD_NUMBER: builtins.int
    pendingBytes: builtins.int
    """v1.2.0: number of bytes queued to send to the peer"""
    @property
    def wantlist(self) -> global___Message.Wantlist: ...
    @property
    def blocks(self) -> google.protobuf.internal.containers.RepeatedScalarFieldContainer[builtins.bytes]:
        """v1.0.0: deprecated in v1.1.0, but still supported for compatibility"""

    @property
    def payload(self) -> google.protobuf.internal.containers.RepeatedCompositeFieldContainer[global___Message.Block]:
        """v1.1.0+: blocks with CID prefix"""

    @property
    def blockPresences(self) -> google.protobuf.internal.containers.RepeatedCompositeFieldContainer[global___Message.BlockPresence]:
        """v1.2.0: Have/DontHave responses"""

    def __init__(
        self,
        *,
        wantlist: global___Message.Wantlist | None = ...,
        blocks: collections.abc.Iterable[builtins.bytes] | None = ...,
        payload: collections.abc.Iterable[global___Message.Block] | None = ...,
        blockPresences: collections.abc.Iterable[global___Message.BlockPresence] | None = ...,
        pendingBytes: builtins.int = ...,
    ) -> None: ...
    def HasField(self, field_name: typing.Literal["wantlist", b"wantlist"]) -> builtins.bool: ...
    def ClearField(self, field_name: typing.Literal["blockPresences", b"blockPresences", "blocks", b"blocks", "payload", b"payload", "pendingBytes", b"pendingBytes", "wantlist", b"wantlist"]) -> None: ...

global___Message = Message
