"""
This type stub file was generated by pyright.
"""

import datetime
from dataclasses import dataclass
from typing import Dict, Optional, TYPE_CHECKING, Union
from nats import NATS

if TYPE_CHECKING:
    ...
_V1_TOKEN_COUNT = ...
_V2_TOKEN_COUNT = ...
@dataclass
class Msg:
    """
    Msg represents a message delivered by NATS.
    """
    _client: NATS
    subject: str = ...
    reply: str = ...
    data: bytes = ...
    headers: Optional[Dict[str, str]] = ...
    _metadata: Optional[Metadata] = ...
    _ackd: bool = ...
    _sid: Optional[int] = ...
    class Ack:
        Ack = ...
        Nak = ...
        Progress = ...
        Term = ...
        Prefix0 = ...
        Prefix1 = ...
        Domain = ...
        AccHash = ...
        Stream = ...
        Consumer = ...
        NumDelivered = ...
        StreamSeq = ...
        ConsumerSeq = ...
        Timestamp = ...
        NumPending = ...
    
    
    @property
    def header(self) -> Optional[Dict[str, str]]:
        """
        header returns the headers from a message.
        """
        ...
    
    @property
    def sid(self) -> int:
        """
        sid returns the subscription ID from a message.
        """
        ...
    
    async def respond(self, data: bytes) -> None:
        """
        respond replies to the inbox of the message if there is one.
        """
        ...
    
    async def ack(self) -> None:
        """
        ack acknowledges a message delivered by JetStream.
        """
        ...
    
    async def ack_sync(self, timeout: float = ...) -> Msg:
        """
        ack_sync waits for the acknowledgement to be processed by the server.
        """
        ...
    
    async def nak(self, delay: Union[int, float, None] = ...) -> None:
        """
        nak negatively acknowledges a message delivered by JetStream triggering a redelivery.
        if `delay` is provided, redelivery is delayed for `delay` seconds
        """
        ...
    
    async def in_progress(self) -> None:
        """
        in_progress acknowledges a message delivered by JetStream is still being worked on.
        Unlike other types of acks, an in-progress ack (+WPI) can be done multiple times.
        """
        ...
    
    async def term(self) -> None:
        """
        term terminates a message delivered by JetStream and disables redeliveries.
        """
        ...
    
    @property
    def metadata(self) -> Metadata:
        """
        metadata returns the Metadata of a JetStream message.
        """
        ...
    
    @dataclass(frozen=True)
    class Metadata:
        """
        Metadata is the metadata from a JetStream message.

        - num_pending is the number of available messages in the Stream that have not been
          consumed yet.
        - num_delivered is the number of times that this message has been delivered.
          For example, num_delivered higher than one means that there have been redeliveries.
        - timestamp is the time at which the message was delivered.
        - stream is the name of the stream.
        - consumer is the name of the consumer.

        """
        sequence: SequencePair
        num_pending: int
        num_delivered: int
        timestamp: datetime.datetime
        stream: str
        consumer: str
        domain: Optional[str] = ...
        @dataclass(frozen=True)
        class SequencePair:
            """
            SequencePair represents a pair of consumer and stream sequence.
            """
            consumer: int
            stream: int
            ...
        
        
    
    


