syntax = "proto3";

package admin;

service AdminService {
  rpc ListUsers (ListUsersRequest) returns (ListUsersResponse);
  rpc ListBotAccounts (ListUsersRequest) returns (ListUsersResponse);
  rpc UpdateUserProfile (UpdateUserRequest) returns (AdminUser);
  rpc ResetPassword (ResetPasswordRequest) returns (AdminUser);
  rpc SuspendUser (UserIdRequest) returns (AdminUser);
  rpc SetSuperAdmin (SetSuperAdminRequest) returns (AdminUser);
  rpc SetUserVerification (SetUserVerificationRequest) returns (AdminUser);
  rpc ListVerificationIcons (Empty) returns (ListVerificationIconsResponse);
}

message Empty {}

message ListUsersRequest {
  optional string search = 1;
}

message UserIdRequest {
  string userId = 1;
}

message UpdateUserRequest {
  string userId = 1;
  optional string displayName = 2;
  optional string email = 3;
  optional string phone = 4;
  optional string backupEmail = 5;
  optional string backupPhone = 6;
  optional string status = 7;
}

message ResetPasswordRequest {
  string userId = 1;
  string newPassword = 2;
}

message SetSuperAdminRequest {
  string actorUserId = 1;
  string userId = 2;
  bool isSuperAdmin = 3;
}

message SetUserVerificationRequest {
  string actorUserId = 1;
  string userId = 2;
  bool isVerified = 3;
  optional string verificationIcon = 4;
}

message VerificationIconOption {
  string slug = 1;
  string name = 2;
}

message ListVerificationIconsResponse {
  repeated VerificationIconOption icons = 1;
}

message AdminUser {
  string id = 1;
  optional string email = 2;
  optional string phone = 3;
  optional string backupEmail = 4;
  optional string backupPhone = 5;
  string displayName = 6;
  optional string username = 7;
  bool isSuperAdmin = 8;
  string status = 9;
  string createdAt = 10;
  repeated string roles = 11;
  repeated string directPermissions = 12;
  bool isVerified = 13;
  optional string verificationIcon = 14;
  bool isBot = 15;
  optional string linkedBotUsername = 16;
  optional bool isSystemBot = 17;
}

message ListUsersResponse {
  repeated AdminUser users = 1;
}
