syntax = "proto3";
package wechaty.puppet;

option go_package       = "github.com/wechaty/go-grpc/wechaty/puppet";
option java_package     = "io.github.wechaty.grpc.puppet";
option csharp_namespace = "github.wechaty.grpc.puppet";

import "google/protobuf/wrappers.proto";
import "google/protobuf/timestamp.proto";

import "wechaty/puppet/util.proto";

message RoomListRequest {}
message RoomListResponse {
  repeated string ids = 1;
}

message RoomPayloadRequest {
  string id = 1;
}
message RoomPayloadResponse {
  string   id                = 1;
  string   topic             = 2; // 群名称
  string   avatar            = 3; // 群头像
  string   owner_id          = 4; // 群主id
  repeated string admin_ids  = 5; // 群管理员id列表
  repeated string member_ids = 6; // 群成员id列表
  string   handle            = 7; // IM内部id，企微中为群的chat_id
  string   additional_info   = 8;
  string   room_remark       = 9;
  bool     external          = 10;
  google.protobuf.Timestamp create_time = 11;
}

message RoomAddRequest {
  string id          = 1;
  string contact_id  = 2; // 被邀请联系人id
  bool   invite_only = 3; // 不明确，目前没见到使用这个的地方
  repeated string quote_ids = 4; // 要附带的聊天消息 id 列表
  repeated string contact_ids = 5; // 邀请的联系人id列表,优先用这个
}
message RoomAddResponse {}

message RoomAddV2Request {
  string id = 1;
  repeated string contact_ids = 2;
  bool invite_only = 3;
  repeated string quote_ids = 4;
}
message RoomAddV2Response {
  repeated string success_ids = 1;
  repeated string failed_ids = 2;
  repeated string failed_reasons = 3;
}

message RoomDelV2Request {
  string id = 1;
  repeated string contact_ids = 2;
}
message RoomDelV2Response {
  repeated string success_ids = 1;
  repeated string failed_ids = 2;
  repeated string failed_reasons = 3;
}

message RoomAvatarRequest {
  string id = 1;
}
message RoomAvatarResponse {
  string file_box = 1;
}

message RoomCreateRequest {
  repeated string contact_ids = 1; // 初始群成员id
  string   topic              = 2; // 群名称
}
message RoomCreateResponse {
  string id = 1;
}

message RoomDelRequest {
  string   id                 = 1;
  string   contact_id         = 2 [deprecated = true]; // Deprecated, will be removed after bot updated
  repeated string contact_ids = 3;
}
message RoomDelResponse {}

message RoomQuitRequest {
  string id = 1;
}
message RoomQuitResponse {}

message RoomTopicRequest {
  string                      id                            = 1;
  google.protobuf.StringValue topic_string_value_deprecated = 2 [deprecated = true];  // DEPRECATED, will be removed after Dec 31, 2022
  optional                    string topic                  = 3;
}
message RoomTopicResponse {
  google.protobuf.StringValue topic_string_value_deprecated = 1 [deprecated = true];  // DEPRECATED, will be removed after Dec 31, 2022
  string                      topic                         = 2;
}

message RoomQRCodeRequest {
  string id = 1;
}
message RoomQRCodeResponse {
  string qrcode = 1;
}

message RoomParseDynamicQRCodeRequest {
  string url = 1; // 群活码链接
}
message RoomParseDynamicQRCodeResponse {
  string qrcode = 1; // 二维码url
  string qrcode_image_url = 2; // 二维码图片url
  string room_name = 3; // 群名称
}

message RoomAnnounceRequest { // 群公告
  string                      id                           = 1;
  google.protobuf.StringValue text_string_value_deprecated = 2 [deprecated = true];  // DEPRECATED, will be removed after Dec 31, 2022
  optional                    string text                  = 3;
}
message RoomAnnounceResponse {
  google.protobuf.StringValue text_string_value_deprecated = 1 [deprecated = true];  // DEPRECATED, will be removed after Dec 31, 2022
  string                      text                         = 2;
}

message RoomRemarkRequest {
  string id = 1;
  string remark = 2;
}

message RoomRemarkResponse {}

message RoomOwnerTransferRequest {
  string id = 1;
  string contact_id = 2;
}

message RoomOwnerTransferResponse {}

message RoomPermissionRequest {
  string id = 1;
  OptionalBoolean invite_confirm = 2;
  OptionalBoolean admin_only_manage = 3;
  OptionalBoolean admin_only_at_all = 4;
  OptionalBoolean mute_all = 5;
  OptionalBoolean forbid_room_topic_edit = 6;
  OptionalBoolean disable_member_mutual_add = 7;
}

message RoomPermissionResponse {
  OptionalBoolean invite_confirm = 1;
  OptionalBoolean admin_only_manage = 2;
  OptionalBoolean admin_only_at_all = 3;
  OptionalBoolean mute_all = 4;
  OptionalBoolean forbid_room_topic_edit = 5;
  OptionalBoolean disable_member_mutual_add = 6;
}

message RoomAdminsRequest {
  string id = 1;
  repeated string contact_ids = 2;
}

message RoomAdminsResponse {}

message RoomDismissRequest {
  string id = 1;
}

message RoomDismissResponse {}

message BatchRoomPayloadRequest {
  repeated string ids = 1;
}

message BatchRoomPayloadResponse {
  repeated RoomPayloadResponse room_payloads = 1;
}
