syntax = "proto3";

option go_package = "./msg";

//登录
message ResLogin {
  string userId = 1;
  string nikeName = 2;
}
message SiteShowRequest {
  int32 InitiatorSitPos = 1;  // 发起比牌请求的玩家
  int32 OpponentSitPos = 2;   // 和谁比
}
message ReqUserInfo {
  string UserId = 1;
  int32 Points = 2;
  string RoomId = 3;
}
//登录 响应
message ReqLogin {
  string nikeName = 1;
  string userId = 2;
  string gameStatus = 3;
  MsgError error = 4;
  int32 points = 5;

}


//进入大厅
message EnterHall {
  string userId = 1;
}

//离开大厅
message LeaveHall {
  string userId = 1;
}
//离开房间
//leaveReason 0 不满足房间条件,1主动离开.
message ReqLeaveRoom {
  string gameId = 1;
  string roomId = 2;
  string userId = 3;
  string leaveReason = 4; //1.
}
//加入房间失败
message JoinRoomFail {
  string gameId = 1;
  string confId = 2;
  string userId = 3;
}

message ReqInsufficientPoints {
  string gameId = 1;
  string userId = 2;
  int32 AvailableAmount = 3;
  int32 RequiredAmount=4;
}

//加入房间
message ResJoinRoom {
  string userId = 1;
  string confId = 2;
  string gameId = 3;
}

//房间相应房间信息
message ReqJoinRoom {
  string userId = 1;
  string roomId = 2;
  string gameId = 3;
  int32 sitPos = 4;
  ReqRoom roomInfo = 5;
}

//下一回合
message NextRound {
  optional ReqJoinRoom Info = 1;
}

//玩法列表
message PlayList {
  string userId = 1;
}

//商城
message Shop {
  string userId = 1;
}

message ResGameInfo {
  string gameId = 1;
}
message ResRoomID {
  string gameId = 1;
  string confId = 2;
  string userId = 3; 
}
message ReqRoomID {
  string gameId = 1;
  string roomId = 2;
  string userId = 3;
}

message ResBet {
  int32 minBlindBet =1;
  int32 maxBlindBet =2;
  int32 minCheelBet =3;
  int32 maxCheelBet =4;
  int32 roomMinBet = 5;
  int32 roomMaxBet = 6;
}
message ReqGameInfo {
  string gameId = 1;
  string gameName = 2;
  string gameStatus = 4;
  string gameType = 5;
  TeenPattiRoomList teenPattiRoomList = 6;
}

message TeenPattiRoomList {
  repeated TeenPattiRoom teenPattiRoom = 1;
}

message TeenPattiRoom {
  
  string boot = 1; //1
  string minBuyin = 2; // 1
  string chaalLimmit = 3; // 128
  string potLimit = 4; //1024
  string totalPlayers = 5; // 3999
  string roomLevel = 6; //low - mid - high
  string confId = 7;
  string type = 8; 

}

// 通知客户端发牌
message ReqDealCard {
  optional int32 sitPos = 1;
  optional int32 index = 2;
}

// 通知客户端操作
message ReqPlayerAction {
  int32 sitPos = 1;
  PlayerOpt playerOpt = 2;
}

// 接到玩家操作
message ResPlayerOptAction {
  int32 sitPos = 1;
  PlayerOpt playerOpt = 2;
  string roomId = 3;
  string gameId = 4;
  string userId = 5;
}

// PlayerOptType 玩家操作类型
enum PlayerOptType {
    OPT_NONE        = 0;  // 无操作
    OPT_SEEN   = 1;  // 看牌
    OPT_PACKED     = 2;  // 弃牌
    OPT_CHAAL        = 3;  // 跟注
    OPT_BLIND         = 4;  // 不看牌跟注
    OPT_SELECT      = 5;  // 选择操作
    OPT_SHOW         = 6;  // 亮牌
    OPT_ANTE         = 7;  // 底注
    OPT_SITESHOW         =8;  // 发起上家比牌
    OPT_REFUSESITESHOW         =9;  // 拒绝与上家比牌
    OPT_AGREESITESHOW =10;//同意与上家比牌
    OPT_SELECTSITESHOW         =11;  // 操作上家比牌,同意和拒绝
}

message PlayerOpt {
    PlayerOptType opt_type = 1;  // 操作类型
    int32 bet_amount = 2;        // 下注金额
    int64 timestamp = 3;         // 操作时间戳
    repeated ReqCard seenCards = 4;  // 看牌的牌

}

message ReqRoom {
  string Id = 1;
  repeated ReqPlayer ReqPlayers = 2;
  int32 Status = 3;
  int32 Round = 4;
  ReqGameRound GameRound = 5;
  ResBet BetInfo = 6;
}


message ReqCard {
  int32 Color = 1;
  int32 Point = 2;
}
message  ReqPlayer {
  string Id = 1;
  repeated ReqCard HandCards =2;
  optional int32 SitPos = 3;
  optional bool IsDealer = 4;
  optional bool IsSeen = 5;
  optional bool IsPacked = 6;
  optional bool IsShow = 7;
  optional bool CanShow = 8;
  optional string Nickname = 9;
  optional string Avatar = 10;
}

message ReqPlayerList {
  repeated ReqPlayer ReqPlayers = 1;
}

message ReqGameRound {
  repeated ReqRound Rounds = 1;


}

message ReqBet {
  optional int32 betAmount = 1;
}

message ReqResult {
  optional  int32 roundSitPos = 1;
  optional  int32 result = 2;
}

message ReqRound {
    // 回合数
    int32 round = 1;
    // 回合座位
    int32 roundSitPos = 2;
    // 回合操作
    PlayerOpt playerOpt = 3;
    // 用户id
    string userId = 4;
    ResBet resBet = 5;

}


//error
message MsgError {
  int32 error_code = 1;
  string error_msg = 2;
}

message Hello {
  string name = 1;
}

message ReqRoomTipsMessage {
  string msg = 1;
}

message ResHeartBeat {
  string msg = 1;
}

message ReqHeartBeat {
  string msg = 1;
}