syntax = "proto3";

package bilibili.broadcast.v1;

import "bilibili/rpc/status.proto";
import "google/protobuf/any.proto";

//
service BroadcastRoom {
    //
    rpc Enter(stream RoomReq) returns (stream RoomResp);
}

//
message RoomErrorEvent {
    //
    bilibili.rpc.Status status = 1;
}

//
message RoomJoinEvent {

}

//
message RoomLeaveEvent {

}

//
message RoomMessageEvent {
    //
    string target_path = 1;
    //
    google.protobuf.Any body = 2;
}

//
message RoomOnlineEvent {
    //
    int32 online = 1;
    //
    int32 all_online = 2;
}

//
message RoomReq {
    // {type}://{room_id}
    string id = 1;
    oneof event {
        //
        RoomJoinEvent join = 2;
        //
        RoomLeaveEvent leave = 3;
        //
        RoomOnlineEvent online = 4;
        //
        RoomMessageEvent msg = 5;
    }
}

//
message RoomResp {
    // {type}://{room_id}
    string id = 1;
    oneof event {
        //
        RoomJoinEvent join = 2;
        //
        RoomLeaveEvent leave = 3;
        //
        RoomOnlineEvent online = 4;
        //
        RoomMessageEvent msg = 5;
        //
        RoomErrorEvent err = 6;
    }
}
