"""MTG Online protocol constants and message definitions."""
import enum


class SessionCommandType(enum.IntEnum):
    """Session command types from session_commands.proto"""
    PING = 1000
    LOGIN = 1001
    MESSAGE = 1002
    LIST_USERS = 1003
    GET_GAMES_OF_USER = 1004
    GET_USER_INFO = 1005
    ADD_TO_LIST = 1006
    REMOVE_FROM_LIST = 1007
    DECK_LIST = 1008
    DECK_NEW_DIR = 1009
    DECK_DEL_DIR = 1010
    DECK_DEL = 1011
    DECK_DOWNLOAD = 1012
    DECK_UPLOAD = 1013
    LIST_ROOMS = 1014
    JOIN_ROOM = 1015
    REGISTER = 1016
    ACTIVATE = 1017
    ACCOUNT_EDIT = 1018
    ACCOUNT_IMAGE = 1019
    ACCOUNT_PASSWORD = 1020
    FORGOT_PASSWORD_REQUEST = 1021
    FORGOT_PASSWORD_RESET = 1022
    FORGOT_PASSWORD_CHALLENGE = 1023
    REQUEST_PASSWORD_SALT = 1024
    SET_CARD_ART_PARAMS = 1025
    REPLAY_LIST = 1100
    REPLAY_DOWNLOAD = 1101
    REPLAY_MODIFY_MATCH = 1102
    REPLAY_DELETE_MATCH = 1103
    REPLAY_GET_CODE = 1104
    REPLAY_SUBMIT_CODE = 1105


class GameCommandType(enum.IntEnum):
    """Game command types from game_commands.proto"""
    KICK_FROM_GAME = 1000
    LEAVE_GAME = 1001
    GAME_SAY = 1002
    SHUFFLE = 1003
    MULLIGAN = 1004
    ROLL_DIE = 1005
    DRAW_CARDS = 1006
    UNDO_DRAW = 1007
    FLIP_CARD = 1008
    ATTACH_CARD = 1009
    CREATE_TOKEN = 1010
    CREATE_ARROW = 1011
    DELETE_ARROW = 1012
    SET_CARD_ATTR = 1013
    SET_CARD_COUNTER = 1014
    INC_CARD_COUNTER = 1015
    READY_START = 1016
    CONCEDE = 1017
    INC_COUNTER = 1018
    CREATE_COUNTER = 1019
    SET_COUNTER = 1020
    DEL_COUNTER = 1021
    NEXT_TURN = 1022
    SET_ACTIVE_PHASE = 1023
    DUMP_ZONE = 1024
    REVEAL_CARDS = 1026
    MOVE_CARD = 1027
    SET_SIDEBOARD_PLAN = 1028
    DECK_SELECT = 1029
    SET_SIDEBOARD_LOCK = 1030
    CHANGE_ZONE_PROPERTIES = 1031
    UNCONCEDE = 1032
    JUDGE = 1033
    REVERSE_TURN = 1034


class GameEventType(enum.IntEnum):
    """Game event types from game_event.proto"""
    JOIN = 1000
    LEAVE = 1001
    GAME_CLOSED = 1002
    GAME_HOST_CHANGED = 1003
    KICKED = 1004
    GAME_STATE_CHANGED = 1005
    PLAYER_PROPERTIES_CHANGED = 1007
    GAME_SAY = 1009
    CREATE_ARROW = 2000
    DELETE_ARROW = 2001
    CREATE_COUNTER = 2002
    SET_COUNTER = 2003
    DEL_COUNTER = 2004
    DRAW_CARDS = 2005
    REVEAL_CARDS = 2006
    SHUFFLE = 2007
    ROLL_DIE = 2008
    MOVE_CARD = 2009
    FLIP_CARD = 2010
    DESTROY_CARD = 2011
    ATTACH_CARD = 2012
    CREATE_TOKEN = 2013
    SET_CARD_ATTR = 2014
    SET_CARD_COUNTER = 2015
    SET_ACTIVE_PLAYER = 2016
    SET_ACTIVE_PHASE = 2017
    DUMP_ZONE = 2018
    CHANGE_ZONE_PROPERTIES = 2020
    REVERSE_TURN = 2021
    GAME_LOG_NOTICE = 2022


class ResponseCode(enum.IntEnum):
    """Response codes from response.proto"""
    RespNotConnected = -1
    RespNothing = 0
    RespOk = 1
    RespNotInRoom = 2
    RespInternalError = 3
    RespInvalidCommand = 4
    RespInvalidData = 5
    RespNameNotFound = 6
    RespLoginNeeded = 7
    RespFunctionNotAllowed = 8
    RespGameNotStarted = 9
    RespGameFull = 10
    RespContextError = 11
    RespWrongPassword = 12
    RespSpectatorsNotAllowed = 13
    RespOnlyBuddies = 14
    RespUserLevelTooLow = 15
    RespInIgnoreList = 16
    RespWouldOverwriteOldSession = 17
    RespChatFlood = 18
    RespUserIsBanned = 19
    RespAccessDenied = 20
    RespUsernameInvalid = 21
    RespRegistrationRequired = 22
    RespRegistrationAccepted = 23
    RespUserAlreadyExists = 24
    RespEmailRequiredToRegister = 25
    RespTooManyRequests = 26
    RespPasswordTooShort = 27
    RespAccountNotActivated = 28
    RespRegistrationDisabled = 29
    RespRegistrationFailed = 30
    RespActivationAccepted = 31
    RespActivationFailed = 32
    RespRegistrationAcceptedNeedsActivation = 33
    RespClientIdRequired = 34
    RespClientUpdateRequired = 35
    RespServerFull = 36
    RespEmailBlackListed = 37


class ZoneType(enum.IntEnum):
    """Zone types from serverinfo_zone.proto"""
    PrivateZone = 0
    PublicZone = 1
    HiddenZone = 2


class UserLevelFlag(enum.IntFlag):
    """User level flags from serverinfo_user.proto"""
    IsNothing = 0
    IsUser = 1
    IsRegistered = 2
    IsModerator = 4
    IsAdmin = 8
    IsJudge = 16
