// +bili:type=service
// Code generated by warden.
syntax = "proto3";

package push.service.broadcast;

option go_package = "v1";

import "github.com/gogo/protobuf/gogoproto/gogo.proto";
import "app/service/main/broadcast/model/model.proto";

message CloseReply {
}

message CloseReq {
}

message PingReply {
}

message PingReq {
}

message ConnectReq {
    option (gogoproto.goproto_stringer) = false;
    string server = 1;
    string serverKey = 2;
    string cookie = 3;
    bytes token = 4;
}

message ConnectReply {
    int64 mid = 1;
    string key = 2;
    string roomID = 3;
    string platform = 4;
    repeated int32 accepts = 5;
}

message DisconnectReq {
    int64 mid = 1;
    string key = 2;
    string server = 3;
}

message DisconnectReply {
    bool has = 1;
}

message HeartbeatReq {
    int64 mid = 1;
    string key = 2;
    string server = 3;
}

message HeartbeatReply {
}

message OnlineReq {
    option (gogoproto.goproto_stringer) = false;
    string server = 1;
    map<string, int32> roomCount = 2;
    int32 sharding = 3;
}

message OnlineReply {
    option (gogoproto.goproto_stringer) = false;
    map<string, int32> roomCount = 1;
}

message ReceiveReq {
    int64 mid = 1;
    push.service.broadcast.model.Proto proto = 2;
}

message ReceiveReply {
     push.service.broadcast.model.Proto proto = 1;
}

message ServerListReq {
	string platform = 1;
}

message ServerListReply {
	string domain = 1 [(gogoproto.jsontag) = "domain"];
	int32 tcpPort = 2 [(gogoproto.jsontag) = "tcp_port"];
	int32 wsPort = 3 [(gogoproto.jsontag) = "ws_port"];
	int32 wssPort = 4 [(gogoproto.jsontag) = "wss_port"];
	int32 heartbeat = 5 [(gogoproto.jsontag) = "heartbeat"];
	repeated string nodes = 6 [(gogoproto.jsontag) = "nodes"];
	Backoff backoff = 7 [(gogoproto.jsontag) = "backoff"];
	int32 heartbeatMax = 8 [(gogoproto.jsontag) = "heartbeat_max"];
}

message Backoff {
	int32	MaxDelay = 1 [(gogoproto.jsontag) = "max_delay"];
	int32	BaseDelay = 2 [(gogoproto.jsontag) = "base_delay"];
	float	Factor = 3 [(gogoproto.jsontag) = "factor"];
	float	Jitter = 4 [(gogoproto.jsontag) = "jitter"];
}

service Zerg {
    // Ping Service 
    rpc Ping(PingReq) returns(PingReply);
    // Close Service 
    rpc Close(CloseReq) returns(CloseReply);
    // Connect
    rpc Connect(ConnectReq) returns (ConnectReply);
    // Disconnect
    rpc Disconnect(DisconnectReq) returns (DisconnectReply);
    // Heartbeat
    rpc Heartbeat(HeartbeatReq) returns (HeartbeatReply);
    // RenewOnline
    rpc RenewOnline(OnlineReq) returns (OnlineReply);
    // Receive
    rpc Receive(ReceiveReq) returns (ReceiveReply);
	//ServerList
	rpc ServerList(ServerListReq) returns (ServerListReply);
}
