from typing import Optional

from ._format import FM_UNDEFINED

TCP_MSG_TRAILER = 0x81010077


class MBMessage(object):
    def __init__(
        self,
        token: int,
        format: int = FM_UNDEFINED,
        ttl: int = -1,
        data: bytes = b"",
        headers: bytes = b"",
        trailer: int = TCP_MSG_TRAILER,
        destname: Optional[str] = None,
        remotehost: Optional[str] = None,
    ):
        self.token = token
        self.format = format
        self.ttl = ttl
        self.data = data
        self.headers = headers
        self.trailer = trailer
        self.destname = destname
        self.remotehost = remotehost
