syntax = "proto3";

package hype_train;

option go_package = "hype_train";

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

// HypeTrainCreate is triggered when a hype train starts on a channel.
message HypeTrainCreate {
  option (eventbus.owner.ldap_group) = "team-commerce";
  // The id of the hype train.
  string id = 1;
  // The user id of the broadcaster.
  string broadcaster_user_id = 2;
  // The total points contributed.
  int64 total = 3;
  // The number of points required to reach the next level.
  int64 goal = 4;
  // The most recent contribution.
  Contribution last_contribution = 5;
  // The contributors with the most points contributed.
  repeated Contribution top_contributions = 6;
  // The time at which the hype train started.
  google.protobuf.Timestamp started_at = 7;
  // The time at which the hype train expires. The expiration is extended when
  // the hype train reaches a new level.
  google.protobuf.Timestamp expires_at = 8;
  // The number of points accumulated for the current level only.
  int64 progress = 9;
}

// Contribution by a viewer to the hype train.
message Contribution {
  // The id of the user.
  string user_id = 1;
  // The type of contribution.
  ContributionType type = 2;
  // The total contributed.
  int64 total = 3;
}

// ContributionType is the type of contribution made to a hype train.
enum ContributionType {
  CONTRIBUTION_TYPE_INVALID = 0;
  CONTRIBUTION_TYPE_BITS = 1;
  CONTRIBUTION_TYPE_SUBSCRIPTION = 2;
}
