syntax = "proto3";

package chat_unban_request;

option go_package = "chat_unban_request";

import "eventbus/owner.proto";

// ChatUnbanRequestUpdate is triggered when a user's ban appeal request is resolved by a moderator in the channel in which they were banned.
message ChatUnbanRequestUpdate {
  option (eventbus.owner.ldap_group) = "team-safety";
  // The id of the channel in which the user requested an appeal.
  string user_id = 1;
  // The user that made the appeal request.
  string requester_id = 2;
  oneof resolution {
    ChatUnbanRequestModeratorResolution moderator_resolution = 3;
    ChatUnbanRequestUserCancelResolution user_cancel_resolution = 4;
  }
  // The ID of the ban appeal request.
  string request_id = 5;
}

// ChatUnbanRequestUserCancelResolution is when a user cancels their unban request.
message ChatUnbanRequestUserCancelResolution {}

// ChatUnbanRequestModeratorResolution is when a moderator approves or denies an unban request.
message ChatUnbanRequestModeratorResolution {
  // The moderator (or channel owner) that resolves a ban appeal request.
  string resolver_id = 1;
  // The message included by the resolver explaining their approval/denial.
  string resolver_message = 2;
  // The action taken to resolve the request.
  ChatUnbanRequestModeratorResolutionAction action = 3;
}

// ChatUnbanRequestModeratorResolutionAction is the action taken by a moderator to resolve this request.
enum ChatUnbanRequestModeratorResolutionAction {
  // An invalid resolution.
  CHAT_UNBAN_REQUEST_MODERATOR_RESOLUTION_ACTION_INVALID = 0;
  // The request is approved.
  CHAT_UNBAN_REQUEST_MODERATOR_RESOLUTION_ACTION_APPROVED = 1;
  // The request is denied.
  CHAT_UNBAN_REQUEST_MODERATOR_RESOLUTION_ACTION_DENIED = 2;
}
