from clarabot_nano_common.common.protocol.request import NanoBaseRequest


class DocumentWsPrepareRequest(NanoBaseRequest):
    TYPE_KEY = "DOC-PRE"

    PATH = "path"


class DocumentWsOpenRequest(NanoBaseRequest):
    TYPE_KEY = "DOC-OPN"

    WSD_WS_URL = "wwu"
    TEMPLATE = "tmpl"


class DocumentWsSessionRequestBase(NanoBaseRequest):
    SESSION = "s"


class DocumentWsCloseRequest(DocumentWsSessionRequestBase):
    TYPE_KEY = "DOC-CLS"


class DocumentWsWriteRequest(DocumentWsSessionRequestBase):
    # NOTE: This is a unique mutating request that has a strict payload processing on its own, so it does not need
    # the mutation-session protection.
    TYPE_KEY = "DOC-TX"

    MESSAGES = "msgs"  # stream-index mapped binary message chunks with "proxy" command


class DocumentWsReadRequest(DocumentWsSessionRequestBase):
    TYPE_KEY = "DOC-RX"
