syntax = "proto3";
package schemapack;


enum type {
	KEEP_ALIVE                      = 0;
        
    LOGIN_REQUEST                   = 1;
    VERIFY_REQUEST                  = 2;
    LOGIN_RESPONSE                  = 3;
        
    ALLGAMES_REQUEST                = 10;
    ALLGAMES_RESPONSE               = 11;
    AG_TOURNAMENT_SELECT_REQUEST    = 12;
    AG_TOURNAMENT_SELECT_RESPONSE   = 13;
    AG_BATTLE_SELECT_REQUEST        = 14;
    AG_BATTLE_SELECT_RESPONSE       = 15;
    GAME_SELECT_REQUEST             = 16;
    GAME_SELECT_RESPONSE            = 17;
    
    MYGAMES_REQUEST                 = 30;
    MYGAMES_RESPONSE                = 31;
    MG_TOURNAMENT_SELECT_REQUEST    = 32;
    MG_TOURNAMENT_SELECT_RESPONSE   = 33;
    MG_BATTLE_SELECT_REQUEST        = 34;
    MG_BATTLE_SELECT_RESPONSE       = 35;
    
    LEAGUE_LEADERBOARD_REQUEST      = 50;
    LEAGUE_LEADERBOARD_RESPONSE     = 51;
    JOIN_REQUEST                    = 52;
    JOIN_RESPONSE                   = 53;
    CANCEL_JOIN                     = 54;
    BATTLE_MATCH_STATUS             = 55;
    BATTLE_MATCH_RESPONSE           = 56;
    GAME_LOAD_STATUS                = 57;
    OPPN_GAME_LOAD_STATUS           = 58;
    PROFILE_REQUEST                 = 60;
    PROFILE_RESPONSE                = 61;
        
    PROFILE_WALLET_REQUEST          = 62;   
    PROFILE_WALLET_RESPONSE         = 63;
    PROFILE_TRANSACTION_REQUEST     = 64;
    PROFILE_TRANSACTION_RESPONSE    = 65;
    PROFILE_GAMES_REQUEST           = 66;
    PROFILE_GAMES_RESPONSE          = 67;
        
    BONUS_REQUEST                   = 68;
    BONUS_RESPONSE                  = 69;
    INVITE_REQUEST                  = 70;
    INVITE_RESPONSE                 = 71;
    BUY_POPULATE_REQUEST            = 72;
    BUY_POPULATE_RESPONSE           = 73;
    WITHDRAW_POPULATE_REQUEST       = 74;
    WITHDRAW_POPULATE_RESPONSE      = 75;
    PAYMENT_REQUEST                 = 76;
    PAYMENT_RESPONSE                = 77;
    EARN_TOKEN_REQUEST              = 78;
    EARN_TOKEN_RESPONSE             = 79;
        
    LOBBY_UPDATE                    = 90;
    TRUE_CALLER_UPDATE              = 91;
        
    GAME_START                      = 96;
    GAME_END                        = 97;
    MESSAGE_ACK                     = 98;
        
    START_GAME_REQUEST              = 100;
    START_GAME_RESPONSE             = 101;
    ACTION_REQUEST                  = 102;
    ACTION_RESPONSE                 = 103;   
    FORFIET_REQUEST				    = 107;
    FORFIET_RESPONSE			    = 108; 
    GAME_SNAPSHOT_REQUEST           = 111;
    GAME_SNAPSHOT_RESPONSE          = 112;
    END_GAME_REQUEST                = 104;
    END_GAME_RESPONSE               = 105;
    GAME_UPDATE                     = 106;
    REPLAY_REQUEST                  = 113;
    REPLAY_RESPONSE                 = 114;
    LEADERBOARD_REQUEST             = 115;
    LEADERBOARD_RESPONSE            = 116;

    READY                           = 200;
    ASYNC_START_GAME                = 201;
    WORLD_UPDATE                    = 202;
    ASYNC_ACTION_REQ                = 203;
    ASYNC_END_GAME                  = 204;
    ASYNC_RESYNC_REQ				= 205;

    
    PING                            = 501;
    PONG                            = 502;
    RECONN_REQUEST                  = 503;
    RECONN_RESPONSE                 = 504;
    ACTION_ASYNC                    = 301;
    SNAPSHOT_ASYNC                  = 303;
}

message AsyncStartGame
{
	int32 playerId = 1;
	repeated BattlePlayer players = 2;
	int32 remainingGameTime = 3;
	int32 actualGameTime = 4; 
	string serverTime = 5;
	bytes gameWorld = 6;
	ABATTLE_GAME_STATE battleGameState = 7;
	repeated AckStatus lastAckStatus = 8;
	int32 startGameTime = 9;
}

message AsyncActionRequest
{
   int32 actionId = 1;
   string clientTime = 2;
   bytes gameSpecificAction = 3;
}
message AckStatus
{
   int32 playerID = 1;
   int32 lastAckID = 2;
}
message WorldUpdate
{
   string serverTime = 1;
   ABATTLE_GAME_STATE battleGameState = 2;
   repeated AckStatus lastAckStatus = 3;
   bytes gameSpecificUpdate = 4;
}
enum ABATTLE_GAME_STATE
{
   BGS_NONE = 0;
   BGS_START = 1;
   BGS_PROGRESS = 2;
   BGS_PAUSED = 3;
   BGS_END = 4;
}
message BattlePlayer
{
    int32 playerID = 1;
    string picture = 2;
    string name = 3;
    bool isJoined = 4;
    int32 score = 5;
}

message StairsGameWorld
{
  Vector2D dimension = 1;
  repeated Vector2D coins = 2;
  repeated EnemyData enemies = 3;
  repeated PlayerObjectUpdate playersData = 4;
  int32 playerMoveTime = 5;
  int32 opponentMoveTime = 6;
}
message EnemyData
{
  Vector2D pos = 1;
  int32 numPieces = 2;
  int32 moveTime = 3;
  DIRECTION direction = 4;
  int32 lastUpdateTime = 5;
  int32 id = 6;
}

message GameUpdate 
{
   repeated Vector2D coinsRemoved= 1;
   repeated Vector2D coinsAdded= 2;
   repeated PlayerObjectUpdate playerUpdate = 3;
   repeated EnemyData enemyUpdate = 4;
}

message PlayerObjectUpdate 
{
    int32 id = 1;
    Vector2D position = 2;
    DIRECTION direction = 3;
    PLAYER_STATE state = 4;    
    int32 score = 5;
    int32 color = 6;
    int32 actionId = 7;
    int32 bValid = 8;
}

enum PLAYER_STATE 
{
    P_NONE = 0;
    DEAD = 1;
    FROZEN = 2;
}

enum GAME_STATE {
    NONE = 0;
   INIT = 5;
   STARTING = 6;
   PROGRESS = 7;
   PAUSED = 8;
   END = 9;
   CANCELLED = 10;
}

message StairsBActionRequest 
{
    DIRECTION direction = 1;
    Vector2D position  = 2;
}

message BStairsRowNPCInfo
{
    int32 rowNo = 1;
    repeated StairsNPCInfo nPCInfoList = 2;
    repeated int32 coins = 3;
    float velocity = 4;
    int32 timeElapsedSinceLastUpdate = 5;    
}

enum DIRECTION {
    NO_DIRECTION = 0;
    UP = 1;
    RIGHT = 2;
    DOWN = 3;
    LEFT = 4;
}

enum CollisionType {
    NO_COLLISION = 0;
    FATAL = 1;
    COLLECTABLE = 2;
}
message Vector {

    int32 x = 1;
    int32 y = 2;
    int32 z = 3;
}

message Vector2D {

    int32 x = 1;
    int32 y = 2;
}

message Player {

    int32 playerID = 1;
    string picture = 2;
    string name = 3;
}

message StairsNPCInfo
{
    int32 colFirstPiece = 1;
    int32 noOfPieces = 2;    
}

message WALLET_CONTENT
{
    int32 playMoney                 = 1;
    int32 withdrawMoney             = 2;
}

message MOGResponseHeader {

    string version          = 1;
    string correlationId    = 2;    
    string timestamp        = 3;
    bool error            = 4;
    string errorMessage     = 5;
    WALLET_CONTENT wallet    = 6;
}
message gameRequestResponse {


	gameHeader header       = 1;
    MOGResponseHeader resHeader = 2;
    type messageType        = 3 ;
	bytes eventSpecificData = 4;
}

message gameHeader {

	string version = 1;
	string correlationId = 2;
	string timestamp = 3;
}

message PrizeBucket {
    float cash = 1;
    float bonus = 2;
    float chips = 3;
    repeated PrizeTypes prizeTypes = 4;
 }
 enum PrizeTypes {
    CASH = 0;
    BONUS = 1;
    CHIPS = 2;
 }

message EndPlayerInfo
{
	int32 playerID = 1;
	BATTLE_RESULT_TYPE resultType = 2;
	float winAmount = 3;
    int32 score = 4;
    int32 winCount = 5;
    PrizeBucket bucket   = 6;
}
message AsyncEndGame
{
  repeated EndPlayerInfo endGameInfo = 1;
  string serverTime = 2;
  bytes gameSpecificData = 3;
  repeated BattlePlayer players = 4;
  int32 playerId = 5;
  int32 rematchAllowed = 6;
  float rematchFee = 7;
  bool sufficientBalance =8;
}

message AsyncReconnRequest
{
	repeated AsyncActionRequest pendingReqs = 1;
}

enum BATTLE_RESULT_TYPE
{
	NO_RESULT = 0;
	WIN = 1;
	LOST = 2;
	TIE = 3;
    FOREFIET = 4;
}