package msg

import (
	"encoding/json"
	"leafstalk/covenant/model"
)

// Entry 登录
type ChapterSyncEntry struct {
	PlayerId   int64  `json:"userId"`
	Token      string `json:"token"`
	LineId     int    `json:"serverId"`
	SyncRoomId int64  `json:"matchRoomId,string"`
	ReLogin    int32  `json:"reLogin"` // 重连1
}

type ResponseChapterSyncEntry struct {
	ErrCode int    `json:"errCode"`
	Msg     string `json:"msg,omitempty"`
	Data    int    `json:"data"`
}

// Entry 重连
type ChapterSyncReLogin struct {
	PlayerId int64 `json:"userId"`
}

// Entry 重连
type ChapterSynToken struct {
	PlayerId int64 `json:"userId"`
}

type JoinerAttr struct {
	PlayerId int64 `json:"userId"`
}

// 创建帧同步房间
type CreateFrameSyncGroupIs struct {
	RpcRequestMsg
	*model.EnterRoomData
}

type ResponseCreateFrameSyncGroupIs struct {
	RpcResponseMsg
	SyncRoomId   int64  `json:"syncRoomId,string"`
	GameSyncAddr string `json:"gameSyncAddr"`
}

type FrameSyncToServer struct {
	PlayerId    int64           `json:"userId"`
	SyncGroupId int64           `json:"syncGroupId,string"`
	FrameId     int64           `json:"frameId"`
	RawData     json.RawMessage `json:"raw,omitempty"`
}

type ReLoginEnterRoom struct {
	PlayerId   int64 `json:"userId"`
	SyncRoomId int64 `json:"matchRoomId,string"`
}

type ResponseReLoginEnterRoom struct {
	ErrCode int                  `json:"errCode"`
	Msg     string               `json:"msg,omitempty"`
	Data    *model.EnterRoomData `json:"data"`
}
