from clarabot_nano_common.common.protocol.request import NanoBaseRequest


class AdminCreateSessionRequest(NanoBaseRequest):
    TYPE_KEY = "A-NEW-SESS"


class NanoCreateRoomConfigBlockRequest(NanoBaseRequest):
    TYPE_KEY = "ROOM-CFG"

    # ROOM_ID is mandatory for this from the base-request obviously
    MEMBER_FLAGS = "member_flags"  # Optional[Dict[str, int]]
    GROUP_FLAGS = "group_flags"  # Optional[int]


class NanoCreateAdhocTokenRequest(NanoBaseRequest):
    TYPE_KEY = "ROOM-ADHOC"

    # ROOM_ID is mandatory for this from the base-request
    TTL = "ttl"  # Optional[int], number of seconds to live

    FS_PATH = "fs_path"  # str for FS-[GET/LS/PEEK/THMB] handlers


class NanoResetAdhocTokensRequest(NanoBaseRequest):
    TYPE_KEY = "ROOM-AHRST"

    # ROOM_ID denotes the tokens to reset for this from the base-request


class NanoCountAdhocTokensRequest(NanoBaseRequest):
    TYPE_KEY = "ROOM-AHCNT"

    # ROOM_ID denotes the tokens to reset for this from the base-request


class AdminLogStreamRequest(NanoBaseRequest):
    TYPE_KEY = "A-LOG-S"
    NAME = "name"  # like "service" or "access"
    NEW = "new"  # Optional[bool]


class AdminLogReadRequest(NanoBaseRequest):
    TYPE_KEY = "A-LOG-R"
    NAME = "name"  # like "service" or "access"


class AbstractSpecificInterNanoJobRequest(NanoBaseRequest):
    # ROOM_ID is mandatory for this from the base-request
    JOB_ID = "job_id"  # int


class DescribeSpecificInterNanoJobRequest(AbstractSpecificInterNanoJobRequest):
    TYPE_KEY = "RINJ-DESC"


class DeleteSpecificInterNanoJobRequest(AbstractSpecificInterNanoJobRequest):
    TYPE_KEY = "RINJ-DEL"


class AddInterNanoJobRequest(NanoBaseRequest):
    TYPE_KEY = "RINJ-ADD"
    # ROOM_ID is mandatory for this from the base-request
    JOB_TYPE = "job_type"  # str
    JOB_ATTRS = "job_attrs"  # dict[str, Any]


class ListInterNanoJobsRequest(NanoBaseRequest):
    TYPE_KEY = "RINJ-LIST"
    # ROOM_ID is mandatory for this from the base-request
