syntax = "proto3";
package live.xanchor.v1;
option go_package = "v1";

import "github.com/gogo/protobuf/gogoproto/gogo.proto";

message ExpData {
    int64 level = 1 [(gogoproto.moretags) = "validate:\"gt=0,required\""];
    int64 next_level = 2 [(gogoproto.moretags) = "validate:\"gt=0,required\""];
    int64 level_color = 3 [(gogoproto.moretags) = "validate:\"gt=0,required\""];
    int64 exp = 4 [(gogoproto.moretags) = "validate:\"gt=0,required\""];
    int64 current_level_exp = 5 [(gogoproto.moretags) = "validate:\"gt=0,required\""];
    int64 next_level_exp = 6 [(gogoproto.moretags) = "validate:\"gt=0,required\""];
}

message TagData {
    int64 tag_id = 1 [(gogoproto.moretags) = "validate:\"gt=0,required\""];
    int64 tag_type = 2 [(gogoproto.moretags) = "validate:\"gt=0,required\""];
    int64 tag_value = 3 [(gogoproto.moretags) = "validate:\"gt=0,required\""];
    string tag_attribute = 4 [(gogoproto.moretags) = "validate:\"required\""];
}

message RoomData {
    int64 uid = 1 [(gogoproto.moretags) = "validate:\"gt=0,required\""];
    int64 room_id = 2 [(gogoproto.moretags) = "validate:\"gt=0,required\""];
    int64 short_id = 3 [(gogoproto.moretags) = "validate:\"gt=0,required\""];
    string title = 4 [(gogoproto.moretags) = "validate:\"required\""];
    string cover = 5;
    string tags = 6;
    string background = 7;
    string description = 8;
    int64 live_status = 9 [(gogoproto.moretags) = "validate:\"gt=0,required\""];
    int64 live_start_time = 10 [(gogoproto.moretags) = "validate:\"gt=0,required\""];
    int64 live_screen_type = 11 [(gogoproto.moretags) = "validate:\"gt=0,required\""];
    int64 live_mark = 12;
    int64 lock_status = 13;
    int64 lock_time = 14;
    int64 hidden_status = 15 [(gogoproto.moretags) = "validate:\"gt=0,required\""];
    int64 hidden_time = 16;
    int64 area_id = 17 [(gogoproto.moretags) = "validate:\"gt=0,required\""];
    string area_name = 18 [(gogoproto.moretags) = "validate:\"required\""];
    int64 parent_area_id = 19 [(gogoproto.moretags) = "validate:\"gt=0,required\""];
    string parent_area_name = 20 [(gogoproto.moretags) = "validate:\"required\""];
    string keyframe = 21;
    int64 popularity_count = 22;
    repeated TagData room_tag_list = 23;
    repeated TagData anchor_tag_list = 24;
    int64 anchor_profile_type = 25;
    repeated ExpData anchor_exp = 26;
    int64 anchor_round_switch = 27;
    int64 anchor_round_status = 28;
    int64 anchor_record_switch = 29;
    int64 anchor_record_status = 30;
    int64 anchor_san = 31;
    int64 live_type = 32;
}

message RoomByIDsReq {
    repeated int64 room_ids = 1;
    repeated int64 uids = 2;
    repeated string fields = 3;
    int64 default_fields = 4;
}

message RoomByIDsResp {
    map<int64, RoomData> room_data_set = 1;
}

message RoomOnlineListReq {
    string filter = 1;
    string sort = 2;
    int64 page = 3;
    int64 page_size = 4;
    repeated string fields = 5;
}

message RoomOnlineListResp {
    map<int64, RoomData> room_data_list = 1;
}

message RoomCreateReq {
    int64 uid = 1 [(gogoproto.moretags) = "validate:\"gt=0,required\""];
    int64 room_id = 2;
}

message RoomCreateResp {
    int64 room_id = 1;
}

message UpdateResp {
    int64 affected_rows = 1;
}

message RoomUpdateReq {
    repeated string fields = 1 [(gogoproto.moretags) = "validate:\"required\""];
    int64 room_id = 2 [(gogoproto.moretags) = "validate:\"gt=0,required\""];
    string title = 3;
    string cover = 4;
    string tags = 5;
    string background = 6;
    string description = 7;
    int64 live_start_time = 8;
    int64 live_screen_type = 9;
    int64 lock_status = 10;
    int64 lock_time = 11;
    int64 hidden_time = 12;
    int64 area_id = 13;
    int64 anchor_round_switch = 14;
    int64 anchor_record_switch = 15;
    int64 live_type = 16;
}

message RoomBatchUpdateReq {
    repeated RoomUpdateReq reqs = 1 [(gogoproto.moretags) = "validate:\"required\""];
}

message AnchorData {
    int64 uid = 1 [(gogoproto.moretags) = "validate:\"gt=0,required\""];
    int64 profile_type = 2 [(gogoproto.moretags) = "validate:\"gt=0,required\""];
    repeated ExpData exp = 3 [(gogoproto.moretags) = "validate:\"gt=0,required\""];
}

message AnchorUpdateReq {
    repeated string fields = 1 [(gogoproto.moretags) = "validate:\"required\""];
    int64 uid = 2 [(gogoproto.moretags) = "validate:\"gt=0,required\""];
    int64 profile_type = 3;
    int64 san_score = 4;
    int64 round_status = 5;
    int64 record_status = 6;
    int64 exp = 7;
}

message AnchorBatchUpdateReq {
    repeated AnchorUpdateReq reqs = 1 [(gogoproto.moretags) = "validate:\"required\""];
}

message AnchorIncreReq {
    string req_id = 1 [(gogoproto.moretags) = "validate:\"required\""];
    repeated string fields = 2 [(gogoproto.moretags) = "validate:\"required\""];
    int64 uid = 3 [(gogoproto.moretags) = "validate:\"gt=0,required\""];
    int64 san_score = 4;
    int64 exp = 5;
}

message AnchorBatchIncreReq {
    repeated AnchorIncreReq reqs = 1 [(gogoproto.moretags) = "validate:\"required\""];
}

message RoomExtendUpdateReq {
    repeated string fields = 1 [(gogoproto.moretags) = "validate:\"required\""];
    int64 room_id = 2 [(gogoproto.moretags) = "validate:\"gt=0,required\""];
    string key_frame = 3;
    int64 danmu_count = 4;
    int64 popularity_count = 5;
    int64 audience_count = 6;
    int64 gift_count = 7;
    int64 gift_gold_amount = 8;
    int64 gift_gold_count = 9;
}

message RoomExtendBatchUpdateReq {
    repeated RoomExtendUpdateReq reqs = 1 [(gogoproto.moretags) = "validate:\"required\""];
}

message RoomExtendIncreReq {
    string req_id = 1 [(gogoproto.moretags) = "validate:\"required\""];
    repeated string fields = 2 [(gogoproto.moretags) = "validate:\"required\""];
    int64 room_id = 3 [(gogoproto.moretags) = "validate:\"gt=0,required\""];
    int64 danmu_count = 4;
    int64 popularity_count = 5;
    int64 audience_count = 6;
    int64 gift_count = 7;
    int64 gift_gold_amount = 8;
    int64 gift_gold_count = 9;
}

message RoomExtendBatchIncreReq {
    repeated RoomExtendIncreReq reqs = 1 [(gogoproto.moretags) = "validate:\"required\""];
}

message RoomTagSetReq {
    repeated string fields = 1 [(gogoproto.moretags) = "validate:\"required\""];
    int64 room_id = 2 [(gogoproto.moretags) = "validate:\"gt=0,required\""];
    int64 tag_type = 3 [(gogoproto.moretags) = "validate:\"gt=0,required\""];
    int64 tag_value = 4;
    string tag_attribute = 5;
    int64 tag_expire_at = 6;
}

message AnchorTagSetReq {
    repeated string fields = 1 [(gogoproto.moretags) = "validate:\"required\""];
    int64 anchor_id = 2 [(gogoproto.moretags) = "validate:\"gt=0,required\""];
    int64 tag_type = 3 [(gogoproto.moretags) = "validate:\"gt=0,required\""];
    int64 tag_value = 4;
    string tag_attribute = 5;
    int64 tag_expire_at = 6;
}

service XAnchor {
    // FetchRoomByIDs 查询房间信息
    rpc FetchRoomByIDs(RoomByIDsReq) returns (RoomByIDsResp);
    // RoomOnlineList 在线房间列表
    rpc RoomOnlineList(RoomOnlineListReq) returns (RoomOnlineListResp);
    // RoomCreate 房间创建
    rpc RoomCreate(RoomCreateReq) returns (RoomCreateResp);
    // RoomUpdate 房间信息更新
    rpc RoomUpdate(RoomUpdateReq) returns (UpdateResp);
    // RoomBatchUpdate 房间信息批量更新
    rpc RoomBatchUpdate(RoomBatchUpdateReq) returns (UpdateResp);
    // RoomExtendUpdate 房间扩展信息更新
    rpc RoomExtendUpdate(RoomExtendUpdateReq) returns (UpdateResp);
    // RoomExtendBatchUpdate 房间扩展信息批量更新
    rpc RoomExtendBatchUpdate(RoomExtendBatchUpdateReq) returns (UpdateResp);
    // RoomExtendIncre 房间信息增量更新
    rpc RoomExtendIncre(RoomExtendIncreReq) returns (UpdateResp);
    // RoomExtendBatchIncre 房间信息批量增量更新
    rpc RoomExtendBatchIncre(RoomExtendBatchIncreReq) returns (UpdateResp);
    // RoomTagSet 房间Tag更新
    rpc RoomTagSet(RoomTagSetReq) returns (UpdateResp);

    // AnchorUpdate 主播信息更新
    rpc AnchorUpdate(AnchorUpdateReq) returns (UpdateResp);
    // AnchorBatchUpdate 主播信息批量更新
    rpc AnchorBatchUpdate(AnchorBatchUpdateReq) returns (UpdateResp);
    // AnchorIncre 主播信息增量更新
    rpc AnchorIncre(AnchorIncreReq) returns (UpdateResp);
    // AnchorBatchIncre 主播信息批量增量更新
    rpc AnchorBatchIncre(AnchorBatchIncreReq) returns (UpdateResp);
    // AnchorTagSet 主播Tag更新
    rpc AnchorTagSet(AnchorTagSetReq) returns (UpdateResp);
}
