syntax = "proto3";

package automod_terms_moderation_action;

option go_package = "automod_terms_moderation_action";

import "eventbus/authorization.proto";
import "eventbus/owner.proto";
import "google/protobuf/timestamp.proto";

// AutomodTermsModerationActionCreate is triggered when terms have been added to or removed from an automod list, either blocked or permitted.
message AutomodTermsModerationActionCreate {
  option (eventbus.owner.ldap_group) = "team-safety";
  // The id of the channel in which automod terms are being defined or deleted.
  string user_id = 1;
  // The moderator making changes to channel automod terms.
  string moderator_id = 2;
  // Exactly which action was taken regarding the list and removing vs adding.
  AutomodTermsModerationAction action = 3;
  // The terms being added or removed.
  repeated Term terms = 4;
  // Whether this term was added due to an Automod message approve/deny action.
  bool from_automod = 5;
  // The time at which a term was added or removed.
  google.protobuf.Timestamp modified_at = 6;
  // Whether this term is private, meaning visible to channel owner only
  bool is_private = 7;
}

// Term is an authorized string representing a term being added/removed from a list, these are an authorized field as they may include customer data (this is a workaround as authorized fields do not support repeated types).
message Term {
  eventbus.authorization.String term_string = 1 [(eventbus.authorization.data_classification) = "restricted"];
}

// AutomodTermsModerationAction represents the possible combinations of adding to/removing from blocked/permitted terms lists.
enum AutomodTermsModerationAction {
  // An invalid action.
  AUTOMOD_TERMS_MODERATION_ACTION_INVALID = 0;
  // A new term is added to the Automod blocked terms list.
  AUTOMOD_TERMS_MODERATION_ACTION_ADD_BLOCKED_TERM = 1;
  // A term is removed from the Automod blocked terms list.
  AUTOMOD_TERMS_MODERATION_ACTION_REMOVE_BLOCKED_TERM = 2;
  // A new term is added to the Automod permitted terms list.
  AUTOMOD_TERMS_MODERATION_ACTION_ADD_PERMITTED_TERM = 3;
  // A term is removed from the Automod permitted terms list.
  AUTOMOD_TERMS_MODERATION_ACTION_REMOVE_PERMITTED_TERM = 4;
}
