syntax = "proto3";

package channel_points_custom_reward_redemption;

option go_package = "channel_points_custom_reward_redemption";

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

// ChannelPointsCustomRewardRedemptionUpdate is triggered when a custom reward redemption is updated.
message ChannelPointsCustomRewardRedemptionUpdate {
  option (eventbus.owner.ldap_group) = "team-communications";
  // The redemption's unique ID.
  string id = 1;
  // The ID of the user who redeemed the reward.
  string user_id = 2;
  // The ID of the channel the reward was redeemed on.
  string broadcaster_user_id = 3;
  // The reward that was redeemed.
  CustomReward reward = 4;
  // The user-supplied input, if any.
  string user_input = 5;
  // The status of the redemption (UNFULFILLED, FULFILLED etc).
  RedemptionStatusChange status = 6;
  // The time the redemption was redeemed.
  google.protobuf.Timestamp redeemed_at = 7;
}

// An object representing the state change for RedemptionStatus.
message RedemptionStatusChange {
  bool updated = 1;
  RedemptionStatus value = 2;
  bool has_old_value = 3;
  RedemptionStatus old_value = 4;
}
