syntax = "proto3";

package bits_use;

option go_package = "bits_use";

import "eventbus/owner.proto";

// BitsUseCreate triggers when a user successfully uses Bits, except for cheering, at a broadcaster.
message BitsUseCreate {
  option (eventbus.owner.ldap_group) = "team-payday";
  // The unique bits transaction associated with this cheer
  string bits_transaction_id = 1;
  // The recipient of the bits, as a unique user identifier (not display name)
  string to_user_id = 2;
  // The initiator of the bits use, as a unique user identifier (not display name)
  string from_user_id = 3;
  // The number of bits used to the broadcaster
  int64 bits_amount = 4;
  // The type of bits use that was processed, can come in 1 of 2 forms:
  // - Bits on Extensions Use, in which case some additional information is provided
  // - Bits on Poll Use, in which case no additional information is available
  oneof from {
    Extension extension = 5;
    Poll poll = 6;
  }
}

// Extension is information about Bits use in an extension.
message Extension {
  // The ID of the extension, defined by the extensions team.
  string id = 1;
  // The ID of the product SKU that was used in the extension that was fulfilled.
  string product_id = 2;
  // Display Name of the product.
  string product_display_name = 5;
  // The following fields are deprecated, as they are not emitted consistently by the publishing service. Do not use these fields without consulting with the EventBus/Payday teams.
  // Flag that denotes whether or not the data was sent over the extension pubsub to all instances of the extension.
  bool broadcast = 3 [deprecated = true];
  // Flag used to indicate if the product is in development.
  bool in_development = 4;
}

// Poll is information about Bits use in a poll.
message Poll {
  // The ID of the poll where the Bits were used
  string id = 1;
  // The choice in the poll that the Bits were used to vote with
  string choice_id = 2;
}
