syntax = "proto3";

package channel_points_community_goal;

option go_package = "channel_points_community_goal";

import "eventbus/change.proto";
import "eventbus/owner.proto";

// ChannelPointsCommunityGoalUpdate triggers when a community goal has been updated.
message ChannelPointsCommunityGoalUpdate {
  option (eventbus.owner.ldap_group) = "team-communications";
  // The community goal's unique ID.
  string id = 1;
  // The ID of the channel the reward belongs to.
  string user_id = 2;
  // The community goal's type.
  Type type = 3;
  // The community goal's status.
  StatusChange status = 4;
  // The total amount the goal is attempting to reach.
  eventbus.change.Int64Change goal_amount = 5;
  // The number of points contributed to the goal so far.
  eventbus.change.Int64Change points_contributed = 6;
  // The title of the goal.
  eventbus.change.StringChange title = 7;
}

// Type is the type of community goal for the event.
enum Type {
  TYPE_INVALID = 0;
  TYPE_CREATOR = 1;
  TYPE_BOOST = 2;
}

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

// Status is the status of the community goal.
enum Status {
  STATUS_INVALID = 0;
  STATUS_UNSTARTED = 1;
  STATUS_STARTED = 2;
  STATUS_ENDED = 3;
  STATUS_FULFILLED = 4;
  STATUS_ARCHIVED = 5;
}
