syntax = "proto3";
import "Open_IM/pkg/proto/sdk_ws/ws.proto";
option go_package = "./organization;organization";
package organization;


message CreateDepartmentReq{
  server_api_params.Department departmentInfo = 1;
  string operationID = 2;
  string opUserID = 3;
}

message CreateDepartmentResp{
  int32   errCode = 1;
  string  errMsg = 2;
  server_api_params.Department departmentInfo = 3;
}

message UpdateDepartmentReq{
  server_api_params.Department departmentInfo = 1;
  string operationID = 2;
  string opUserID = 3;
}

message UpdateDepartmentResp{
  int32   errCode = 1;
  string  errMsg = 2;
}


message GetSubDepartmentReq{
  string departmentID = 1;
  string operationID = 2;
  string opUserID = 3;
}

message GetSubDepartmentResp{
  int32   errCode = 1;
  string  errMsg = 2;
  repeated server_api_params.Department departmentList = 3;
}

message DeleteDepartmentReq{
  string departmentID = 1;
  string operationID = 2;
  string opUserID = 3;
}

message DeleteDepartmentResp{
  int32   errCode = 1;
  string  errMsg = 2;
}

message GetDepartmentParentIDListReq {
  string departmentID = 1;
  string operationID = 2;
}

message GetDepartmentParentIDListResp {
  int32   errCode = 1;
  string  errMsg = 2;
  repeated string parentIDList = 3;
}


message CreateOrganizationUserReq{
  server_api_params.OrganizationUser organizationUser = 1;
  string operationID = 2;
  string opUserID = 3;
  bool IsRegister = 4;
}


message CreateOrganizationUserResp{
  int32   errCode = 1;
  string  errMsg = 2;
}


message UpdateOrganizationUserReq{
  server_api_params.OrganizationUser organizationUser = 1;
  string operationID = 2;
  string opUserID = 3;
}


message UpdateOrganizationUserResp{
  int32   errCode = 1;
  string  errMsg = 2;
}




message CreateDepartmentMemberReq{
  server_api_params.DepartmentMember departmentMember = 1;
  string operationID = 2;
  string opUserID = 3;
}
message CreateDepartmentMemberResp{
  int32   errCode = 1;
  string  errMsg = 2;
}


message GetUserInDepartmentReq{
  string userID = 1;
  string operationID = 2;
  string opUserID = 3;
}
message GetUserInDepartmentResp{
  int32   errCode = 1;
  string  errMsg = 2;
  server_api_params.UserInDepartment userInDepartment = 3;
}


message UpdateUserInDepartmentReq{
  server_api_params.DepartmentMember departmentMember = 1;
  string operationID = 2;
  string opUserID = 3;
}
message UpdateUserInDepartmentResp{
  int32   errCode = 1;
  string  errMsg = 2;
}


message DeleteUserInDepartmentReq{
  string userID = 1;
  string operationID = 2;
  string opUserID = 3;
  string departmentID = 4;
}
message DeleteUserInDepartmentResp{
  int32   errCode = 1;
  string  errMsg = 2;
}

message DeleteOrganizationUserReq{
  string userID = 1;
  string operationID = 2;
  string opUserID = 3;
}
message DeleteOrganizationUserResp{
  int32   errCode = 1;
  string  errMsg = 2;
}


message GetDepartmentMemberReq{
  string departmentID = 1;
  string operationID = 2;
  string opUserID = 3;
}

message GetDepartmentMemberResp{
  int32   errCode = 1;
  string  errMsg = 2;
  repeated  server_api_params.UserDepartmentMember userDepartmentMemberList = 3;
}

message GetDepartmentRelatedGroupIDListReq {
  string operationID = 1;
  repeated string departmentIDList = 2;
}

message GetDepartmentRelatedGroupIDListResp {
  int32   errCode = 1;
  string  errMsg = 2;
  repeated string groupIDList = 3;
}

service organization{
  rpc CreateDepartment(CreateDepartmentReq) returns(CreateDepartmentResp);
  rpc UpdateDepartment(UpdateDepartmentReq) returns(UpdateDepartmentResp);
  rpc GetSubDepartment(GetSubDepartmentReq) returns(GetSubDepartmentResp);
  rpc DeleteDepartment(DeleteDepartmentReq) returns(DeleteDepartmentResp);
  rpc GetDepartmentParentIDList(GetDepartmentParentIDListReq) returns(GetDepartmentParentIDListResp);

  rpc CreateOrganizationUser(CreateOrganizationUserReq) returns(CreateOrganizationUserResp);
  rpc UpdateOrganizationUser(UpdateOrganizationUserReq) returns(UpdateOrganizationUserResp);
  rpc DeleteOrganizationUser(DeleteOrganizationUserReq) returns(DeleteOrganizationUserResp);


  rpc CreateDepartmentMember(CreateDepartmentMemberReq) returns(CreateDepartmentMemberResp);
  rpc GetUserInDepartment(GetUserInDepartmentReq) returns(GetUserInDepartmentResp);
  rpc DeleteUserInDepartment(DeleteUserInDepartmentReq) returns(DeleteUserInDepartmentResp);
  rpc UpdateUserInDepartment(UpdateUserInDepartmentReq) returns(UpdateUserInDepartmentResp);
  rpc GetDepartmentMember(GetDepartmentMemberReq) returns(GetDepartmentMemberResp);
  rpc GetDepartmentRelatedGroupIDList(GetDepartmentRelatedGroupIDListReq) returns(GetDepartmentRelatedGroupIDListResp);
}




