syntax = "proto3";

package chat_verification_settings;

option go_package = "chat_verification_settings";

import "eventbus/owner.proto";

// ChatVerificationSettingsUpdate occurs when a channel owner / moderator changes
// their channel moderation settings related to phone or email verification requirements.
message ChatVerificationSettingsUpdate {
  option (eventbus.owner.ldap_group) = "team-safety";
  // The id of the user that updated the channel's phone/email verification settings.
  string requester_user_id = 1;
  // The channel id where the settings are applied.
  string user_id = 2;
  // Setting for the channel's phone/email requirements.
  ChatVerificationSettingsChange chat_verification_settings = 3;
}

// ChatVerificationSettingsChange represents the state change for ChatVerificationSettings.
message ChatVerificationSettingsChange {
  bool updated = 1;
  ChatVerificationSettings value = 2;
  bool has_old_value = 3;
  ChatVerificationSettings old_value = 4;
}

// ChatVerificationSettings are options for the channel owner / moderator
// to choose different levels of phone/email verification required to chat.
message ChatVerificationSettings {
  // Whether or not subscribers are exempt from the channel's phone/email verification requirements.
  bool subscribers_exempt = 1;
  // Whether or not moderators are exempt from the channel's phone/email verification requirements.
  bool moderators_exempt = 2;
  // Whether or not vips are exempt from the channel's phone/email verification requirements.
  bool vips_exempt = 3;
  // Settings for the channel's phone verification requirements.
  oneof phone_verification_policy {
    bool phone_verification_not_required = 4;
    bool phone_verification_required_for_all_users = 5;
    SpecificChatters phone_verification_required_for_specific_chatters = 6;
  }
  // Settings for the channel's email verification requirements.
  oneof email_verification_policy {
    bool email_verification_not_required = 7;
    bool email_verification_required_for_all_users = 8;
    SpecificChatters email_verification_required_for_specific_chatters = 9;
  }
}

// SpecificChatters conveys which subset of chatters must adhere to the channel's account verification requirements.
message SpecificChatters {
  // Whether or not first time chatters must verify to chat.
  bool first_time_chatters = 1;
  // Followers with age less than "x" minutes must verify to chat.
  int64 follower_age_less_than_minutes = 2;
  // Accounts with age less than "x" minutes must verify to chat.
  int64 account_age_less_than_minutes = 3;
}
