syntax = "proto3";

package channel_points_custom_reward;

option go_package = "channel_points_custom_reward";

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

// ChannelPointsCustomRewardCreate triggers when a new custom reward is created on a channel.
message ChannelPointsCustomRewardCreate {
  option (eventbus.owner.ldap_group) = "team-communications";
  // The reward’s unique ID.
  string id = 1;
  // The ID of the channel the reward belongs to.
  string user_id = 2;
  // CDN URLs for reward icons at different resolutions.
  ImageURLs image = 3;
  // Background color for reward icons in hex.
  string background_color = 4;
  // Whether this reward is enabled by the broadcaster. Disabled rewards won't show to viewers.
  bool enabled = 5;
  // Whether this reward is usable by subs only.
  bool sub_only = 6;
  // Number of points a reward costs to redeem.
  int64 cost = 7;
  // A short title used to describe the reward.
  string title = 8;
  // The user-facing prompt that will be shown when users want to redeem the reward.
  string prompt = 9;
  // Whether this reward requires viewer input.
  bool user_input_required = 10;
  // Setting for the maximum number of rewards of this type that can be redeemed per stream.
  // Can be disabled.
  MaxPerStreamSetting max_per_stream_setting = 11;
  // Whether this reward is paused. Paused rewards will show to viewers but can't be redeemed.
  bool paused = 12;
  // Whether this reward is out of stock. If this reward been redeemed the maximum number of times per stream, or if the stream is not live.
  bool in_stock = 13;
  // Default CDN URLs for custom reward icons at different resolutions.
  ImageURLs default_image = 14;
  // Whether this reward should skip appearing in the broadcaster's reward request queue.
  // Redemptions will be created in the FULFILLED state instead of UNFULFILLED.
  bool redemptions_skip_request_queue = 15;
  // The template the reward was created from. Blank if not created from a template.
  string template_id = 16;
  // Setting for the maximum number of rewards of this type that can be redeemed per user per stream.
  // Can be disabled.
  MaxPerUserPerStreamSetting max_per_user_per_stream_setting = 17;
  // Setting for the global cooldown for rewards of this type that can be redeemed if not in cooldown
  // Can be disabled.
  GlobalCooldownSetting global_cooldown_setting = 18;
  // Timestamp of the cooldown expiration for the reward.
  // Null if the reward isn't on cooldown.
  google.protobuf.Timestamp cooldown_expires_at = 19;
  // Number of redemptions redeemed for this reward during the current live stream.
  // This will reset everytime a new stream is started.
  // Null if the channel isn't currently live or the max_per_stream_setting isn't enabled.
  google.protobuf.Int64Value redemptions_redeemed_current_stream = 20;
}

// ImageURLs contains the URLs for an image asset at 1x, 2x and 4x sizes.
message ImageURLs {
  string url_1x = 1;
  string url_2x = 2;
  string url_4x = 3;
}

// MaxPerStreamSetting contains the information for limiting the redemptions of the reward to a maximum per stream.
message MaxPerStreamSetting {
  // Whether the max per stream limit is enabled.
  bool enabled = 1;
  // The maximum number of this reward that can be redeemed per stream.
  int64 max_per_stream = 2;
}

// MaxPerUserPerStreamSetting contains the information for limiting the redemptions of the reward to a maximum per user per stream.
message MaxPerUserPerStreamSetting {
  // Whether the max per user per stream limit is enabled.
  bool enabled = 1;
  // The maximum number of this reward that can be redeemed per stream.
  int64 max_per_user_per_stream = 2;
}

// GlobalCoolDownSetting contains the information for limiting the redemptions of the reward to a set global cooldown.
message GlobalCooldownSetting {
  // Whether the global cooldown limit is enabled.
  bool enabled = 1;
  // The cooldown between redeeming a reward per stream set by the broadcaster
  int64 global_cooldown_seconds = 2;
}
