syntax = "proto3";
package OpenIMServer.user;
import "sdkws/sdkws.proto";
import "conversation/conversation.proto";
option go_package = "github.com/OpenIMSDK/Open-IM-Server/pkg/proto/user";

message getAllUserIDReq{
  sdkws.RequestPagination pagination = 1;
}
message getAllUserIDResp{
  int32 total = 1;
  repeated string userIDs = 2;
}


message accountCheckReq{
  repeated string checkUserIDs = 1;
}
message accountCheckResp{
  message singleUserStatus {
    string userID = 1;
    string accountStatus = 2;
  }
  repeated singleUserStatus results = 1;
}


message getDesignateUsersReq{
  repeated string userIDs = 1;
}
message getDesignateUsersResp{
  repeated sdkws.UserInfo usersInfo = 1;
}

message updateUserInfoReq{
  sdkws.UserInfo userInfo = 1;
}
message updateUserInfoResp{
}

message setGlobalRecvMessageOptReq{
  string userID = 1;
  int32 globalRecvMsgOpt = 3;
}
message setGlobalRecvMessageOptResp{
}

message setConversationReq{
  OpenIMServer.conversation.Conversation conversation = 1;
  int32 notificationType = 2;
  string operationID = 3;
}

message setConversationResp{

}

message setRecvMsgOptReq {
  string ownerUserID = 1;
  string conversationID = 2;
  int32 recvMsgOpt = 3;
  int32 notificationType = 4;
  string operationID = 5;
}

message setRecvMsgOptResp {

}

message getConversationReq{
  string conversationID = 1;
  string ownerUserID = 2;
  string operationID = 3;
}

message getConversationResp{
  OpenIMServer.conversation.Conversation conversation = 2;
}

message getConversationsReq{
  string ownerUserID = 1;
  repeated string conversationIDs = 2;
  string operationID = 3;
}

message getConversationsResp{
  repeated OpenIMServer.conversation.Conversation conversations = 2;
}

message getAllConversationsReq{
  string ownerUserID = 1;
  string operationID = 2;
}

message getAllConversationsResp{
  repeated OpenIMServer.conversation.Conversation conversations = 2;
}

message batchSetConversationsReq{
  repeated OpenIMServer.conversation.Conversation conversations = 1;
  string OwnerUserID = 2;
  int32 notificationType = 3;
  string OperationID = 4;
}

message batchSetConversationsResp{
  repeated string Success = 2;
  repeated string Failed = 3;
}


message getPaginationUsersReq {
  sdkws.RequestPagination pagination = 2;
}

message getPaginationUsersResp{
  int32 total = 1;
  repeated sdkws.UserInfo users = 2;
}

message userRegisterReq {
  repeated sdkws.UserInfo users = 1;
}
message userRegisterResp {
}


message getGlobalRecvMessageOptReq{
  string userID  = 1;
}

message getGlobalRecvMessageOptResp{
  int32 globalRecvMsgOpt = 1;
}

service user {
  //获取指定的用户信息 全字段
  rpc getDesignateUsers(getDesignateUsersReq) returns(getDesignateUsersResp);
  //更新用户信息
  rpc updateUserInfo(updateUserInfoReq) returns(updateUserInfoResp);
  //设置用户消息接收选项
  rpc setGlobalRecvMessageOpt(setGlobalRecvMessageOptReq) returns(setGlobalRecvMessageOptResp);
  //获取用户消息接收选项 没找到不返回错误
  rpc getGlobalRecvMessageOpt(getGlobalRecvMessageOptReq) returns(getGlobalRecvMessageOptResp);
  //检查userID是否存在
  rpc accountCheck(accountCheckReq) returns (accountCheckResp);
  //翻页（或指定userID，昵称）拉取用户信息 全字段
  rpc getPaginationUsers(getPaginationUsersReq) returns (getPaginationUsersResp);
  //用户注册
  rpc userRegister(userRegisterReq) returns (userRegisterResp);
  //获取所有用户ID
  rpc getAllUserID(getAllUserIDReq) returns (getAllUserIDResp);
}

