syntax = "proto3";

package user_gift_subscription_user;

option go_package = "user_gift_subscription_user";

import "eventbus/owner.proto";
import "google/protobuf/wrappers.proto";

// UserGiftSubscriptionUserCreate is triggered when a subscription entitlement has been gifted in the user's channel.
message UserGiftSubscriptionUserCreate {
  option (eventbus.owner.ldap_group) = "team-subs";
  // the purchaser (i.e. twitch viewer) of the subscription entitlement (i.e. viewer who is subscribing)
  // This value is the anonymous user when the gift is anonymous
  string from_user_id = 1;
  // the user/broadcaster that the subscriber is entitled subscription benefits to (i.e. twitch.tv/michael)
  string to_user_id = 2;
  // The amount of gifts that were sent
  int64 quantity = 3;
  // The payments ID that triggered the gift purchase
  string origin_id = 4;
  // The subscription product that's being gifted
  string product_id = 5;
  // If the gift purchaser is anonymous
  bool is_anonymous = 6;
  // The subscription product tier
  Tier tier = 7;
  // The length in months of the Gifted Subscription
  int64 subscription_number_of_months = 8;
  // The total number of gifts ever purchased by the user.
  // Null if the purchaser is anonymous.
  google.protobuf.Int64Value cumulative_total = 9;
  // The recipient of the gift for singular gift events.
  // Null for mass gift events.
  google.protobuf.StringValue recipient_user_id = 10;
}

// Tier the tier value of sub that is attached.
message Tier {
  // the value can be either
  // - an enumerated value (tier 1, 2, 3 subs)
  // - a custom string value (OWL ticket product, legacy ticket products)
  oneof value {
    SubTier numeral = 1;
    string custom = 2;
  }
}

// SubTier is the enumerated values that a sub is normally.
enum SubTier {
  // default case is an invalid sub tier
  SUB_TIER_INVALID = 0;
  // tier 1 subs
  SUB_TIER_1 = 1;
  // tier 2 subs
  SUB_TIER_2 = 2;
  // tier 3 subs
  SUB_TIER_3 = 3;
}
