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

message getPaginationFriendsReq{
  sdkws.RequestPagination pagination = 1;
  string userID = 2;
}
message getPaginationFriendsResp{
  repeated sdkws.FriendInfo FriendsInfo = 1;
  int32 total = 2;



}


message applyToAddFriendReq{
  string fromUserID = 1;
  string toUserID = 2;
  string reqMsg = 3;
  string ex = 4;
}
message applyToAddFriendResp{
}


message importFriendReq{
  string ownerUserID = 1;
  repeated string friendUserIDs = 2;
}

message importFriendResp{
}


message getPaginationFriendsApplyToReq{
  string userID = 1;
  sdkws.RequestPagination pagination = 2;

}
message getPaginationFriendsApplyToResp{
  repeated sdkws.FriendRequest FriendRequests = 1;
  int32 total = 2;
}


message getDesignatedFriendsReq{
  string ownerUserID = 1;
  repeated string friendUserIDs = 2;
}
message getDesignatedFriendsResp{
  repeated sdkws.FriendInfo friendsInfo = 1;
}


message addBlackReq{
  string ownerUserID = 1;
  string blackUserID = 2;
}
message addBlackResp{
}


message removeBlackReq{
  string ownerUserID = 1;
  string blackUserID = 2;
}
message removeBlackResp{
}

message getPaginationBlacksReq{
  string userID = 1;
  sdkws.RequestPagination pagination = 2;
}
message getPaginationBlacksResp{
  repeated sdkws.BlackInfo blacks= 1;
  int32 total = 2;
}


message isFriendReq{
  string userID1 = 1;
  string userID2 = 2;
}
message isFriendResp{
  bool inUser1Friends = 1; //如果userID2在userID1的好友列表中 true
  bool inUser2Friends = 2; //如果userID1在userID2的好友列表中 true
}


message isBlackReq{
  string userID1 = 1;
  string userID2 = 2;
}
message isBlackResp{
  bool inUser1Blacks = 1; //如果userID2在userID1的黑名单列表中 true
  bool inUser2Blacks = 2; //如果userID1在userID2的黑名单列表中 true
}


message deleteFriendReq{
  string ownerUserID = 1;
  string friendUserID = 2;
}
message deleteFriendResp{
}

//process
message respondFriendApplyReq{
  string fromUserID = 1; //主动发起的申请者
  string toUserID = 2;   //被动添加者
  int32  handleResult = 3;
  string handleMsg = 4;
}
message respondFriendApplyResp{
}

message setFriendRemarkReq{
  string ownerUserID = 1;
  string friendUserID = 2;
  string remark = 3;
}
message setFriendRemarkResp{
}

message getPaginationFriendsApplyFromReq{
  string userID = 1;
  sdkws.RequestPagination pagination = 2;
}
message getPaginationFriendsApplyFromResp{
  repeated sdkws.FriendRequest friendRequests = 1;
  int32 total = 2;
}

message getFriendIDsReq {
  string userID = 1;
}

message getFriendIDsResp {
  repeated string friendIDs = 1;
}

service friend{
  //申请加好友
  rpc applyToAddFriend(applyToAddFriendReq) returns(applyToAddFriendResp);
  //获取收到的好友申请列表
  rpc getPaginationFriendsApplyTo(getPaginationFriendsApplyToReq) returns(getPaginationFriendsApplyToResp);
  //获取主动发出去的好友申请列表
  rpc getPaginationFriendsApplyFrom(getPaginationFriendsApplyFromReq) returns(getPaginationFriendsApplyFromResp);
  //添加黑名单
  rpc addBlack(addBlackReq) returns(addBlackResp);
  //移除黑名单
  rpc removeBlack(removeBlackReq) returns(removeBlackResp);
  //判断是否好友关系
  rpc isFriend(isFriendReq) returns(isFriendResp);
  //判断是否在黑名单中
  rpc isBlack(isBlackReq) returns(isBlackResp);
  //获取黑名单列表
  rpc getPaginationBlacks(getPaginationBlacksReq) returns(getPaginationBlacksResp);
  //删除好友
  rpc deleteFriend(deleteFriendReq) returns(deleteFriendResp);
  //对好友申请响应（同意或拒绝）
  rpc respondFriendApply(respondFriendApplyReq) returns(respondFriendApplyResp);
  //设置好友备注
  rpc setFriendRemark(setFriendRemarkReq) returns(setFriendRemarkResp);
  //导入好友关系
  rpc importFriends(importFriendReq)  returns(importFriendResp);
  //翻页获取好友列表 无结果不返回错误
  rpc getDesignatedFriends(getDesignatedFriendsReq) returns(getDesignatedFriendsResp);
  //获取指定好友信息 有id不存在也返回错误
  rpc getPaginationFriends(getPaginationFriendsReq) returns (getPaginationFriendsResp);
  // 获取好友ID列表
  rpc getFriendIDs(getFriendIDsReq) returns (getFriendIDsResp);
}