syntax = "proto3";

package ban_evasion_detection_settings;

option go_package = "ban_evasion_detection_settings";

import "eventbus/change.proto";
import "eventbus/owner.proto";

// BanEvasionDetectionSettingsUpdate is triggered when a moderator or channel owner changes the
// BanEvasionDetectionSettings for a channel.
// Currently all field values are returned with each event.
message BanEvasionDetectionSettingsUpdate {
  option (eventbus.owner.ldap_group) = "team-safety";
  // The user of which the ban evasion settings are applied.
  string broadcaster_user_id = 1;
  // The user who updated the settings.
  string requester_user_id = 2;
  // Denotes whether ban evasion detection is enabled on the channel.
  eventbus.change.BoolChange is_enabled = 3;
  // The treatment for users detected to likely be ban evaders.
  LowTrustUserTreatmentChange likely_evader_treatment = 4;
  // The treatment for users detected to very likely be ban evaders.
  LowTrustUserTreatmentChange very_likely_evader_treatment = 5;
}

// LowTrustUserTreatmentChange represents a state change for a given
// low trust user treatment which follows the eventbus.change.proto scheme.
message LowTrustUserTreatmentChange {
  // Denotes whether the low trust user treatment was changed.
  bool updated = 1;
  // Denotes the current value of the low trust user treatment.
  LowTrustUserTreatmentType value = 2;
  // Denotes whether the previous low trust user treatment is included in the event.
  bool has_old_value = 3;
  // Denotes the previous low trust user treatment value.
  LowTrustUserTreatmentType old_value = 4;
}

// LowTrustUserTreatmentType is comprised of all the possible types
// for a low trust user treatment.
enum LowTrustUserTreatmentType {
  LOW_TRUST_USER_TREATMENT_TYPE_INVALID = 0;
  // The user's chat messages will be actively monitored
  LOW_TRUST_USER_TREATMENT_TYPE_ACTIVE_MONITORING = 1;
  // The user's chat messages will be withheld from chat.
  LOW_TRUST_USER_TREATMENT_TYPE_RESTRICTED = 2;
  // The user will not receive any treatment.
  LOW_TRUST_USER_TREATMENT_TYPE_NO_TREATMENT = 3;
}
