syntax = "proto3";

package chat_moderation_action;

option go_package = "chat_moderation_action";

import "eventbus/owner.proto";

// ChatModificationCreate is triggered when a moderator or channel owner changes the chat mode settings on a channel or clears the chat.
message ChatModerationActionCreate {
  option (eventbus.owner.ldap_group) = "team-communications";
  // The id of the channel upon which changes are being made.
  string user_id = 1;
  // The moderator making changes to channel chat mode settings or clearing the chat.
  string moderator_id = 2;
  // The exact moderation action taken regarding the chat mode or clearing the chat.
  oneof event {
    TimedChatModificationEvent timed_chat_mode = 3;
    BasicChatModificationEvent basic_chat_mode = 4;
    DeleteMessageChatModificationEvent delete_message = 5;
  }
}

// TimedChatModificationEvent is the event when a timed chat mode has been toggled on.
message TimedChatModificationEvent {
  // The exact action taken regarding the chat mode in a channel's chat.
  TimedChatModificationAction action = 1;
  // The duration that chat will be in this chat mode, in seconds.
  string duration = 2;
}

// TimedChatModificationAction is exactly which timed chat mode has been toggled on.
enum TimedChatModificationAction {
  // An invalid action.
  TIMED_CHAT_MODIFICATION_ACTION_INVALID = 0;
  // Turning on slow mode.
  TIMED_CHAT_MODIFICATION_ACTION_SLOW_MODE_ENABLED = 1;
  // Turning on followers only mode.
  TIMED_CHAT_MODIFICATION_ACTION_FOLLOWERS_ONLY_MODE_ENABLED = 3;
}

// BasicChatModificationEvent is the event when a basic chat mode has been toggled.
message BasicChatModificationEvent {
  // The exact action taken regarding the chat mode and whether it was turned on or off in a channel's chat.
  BasicChatModificationAction action = 1;
}

// BasicChatModificationAction is exactly which basic chat mode has been toggled or chat has been cleared.
enum BasicChatModificationAction {
  // An invalid action.
  BASIC_CHAT_MODIFICATION_ACTION_INVALID = 0;
  // Turning on emotes only mode.
  BASIC_CHAT_MODIFICATION_ACTION_EMOTES_ONLY_ENABLED = 1;
  // Turning off emotes only mode.
  BASIC_CHAT_MODIFICATION_ACTION_EMOTES_ONLY_DISABLED = 2;
  // Turning on unique (r9k) mode.
  BASIC_CHAT_MODIFICATION_ACTION_UNIQUE_ENABLED = 3;
  // Turning off unique (r9k) mode.
  BASIC_CHAT_MODIFICATION_ACTION_UNIQUE_DISABLED = 4;
  // Turning on subscribers only mode.
  BASIC_CHAT_MODIFICATION_ACTION_SUBS_ONLY_ENABLED = 5;
  // Turning off subscribers only mode.
  BASIC_CHAT_MODIFICATION_ACTION_SUBS_ONLY_DISABLED = 6;
  // Turning off slow mode.
  BASIC_CHAT_MODIFICATION_ACTION_SLOW_MODE_DISABLED = 7;
  // Turning off followers only mode.
  BASIC_CHAT_MODIFICATION_ACTION_FOLLOWERS_ONLY_MODE_DISABLED = 8;
  // Clearing the chat.
  BASIC_CHAT_MODIFICATION_ACTION_CLEAR = 9;
}

// DeleteMessageChatModificationEvent is the event when a message has been deleted from chat.
message DeleteMessageChatModificationEvent {
  // The id of the message that was deleted.
  string message_id = 1;
  // The user that sent the now deleted message.
  string message_sender_id = 2;
  // The body of the deleted message.
  string message_body = 3;
}
