syntax = "proto3";

package confidence.flags.admin.v1.events;

import "confidence/events/v1/annotations.proto";
import "confidence/flags/admin/v1/types.proto";

option java_package = "com.spotify.confidence.flags.admin.v1.events";
option java_multiple_files = true;
option java_outer_classname = "EventsProto";

// Occurs when a new flag is created
message FlagCreated {
  option (confidence.events.v1.event) = {
    persist: true;
    description: "Occurs when a new flag is created";
  };
  // The flag that was created
  Flag flag = 1;
}

// Occurs when a flag has been updated
message FlagUpdated {
  option (confidence.events.v1.event) = {
    persist: true;
    description: "Occurs when a flag has been updated";
  };
  // The flag that was updated
  Flag flag = 1;
}

// Occurs when a flag is archived
message FlagArchived {
  option (confidence.events.v1.event) = {
    persist: true;
    description: "Occurs when a flag is archived";
  };
  // The flag that was archived
  Flag flag = 1;
}

// Occurs when a segment is created
message SegmentCreated {
  option (confidence.events.v1.event) = {
    persist: true;
    description: "Occurs when a segment is created";
  };
  // The segment that was created
  Segment segment = 1;
}

// Occurs when a segment is updated
message SegmentUpdated {
  option (confidence.events.v1.event) = {
    persist: true;
    description: "Occurs when a segment is updated";
  };
  // The segment that was updated
  Segment segment = 1;
}

// Occurs when a segment is allocated
message SegmentAllocated {
  option (confidence.events.v1.event) = {
    persist: true;
    description: "Occurs when a segment is allocated";
  };
  // The segment that was allocated
  Segment segment = 1;
}

// Occurs when a segment is archived
message SegmentArchived {
  option (confidence.events.v1.event) = {
    persist: true;
    description: "Occurs when a segment is archived";
  };
  // The segment that was archived
  Segment segment = 1;
}

// Occurs when a Rule is enabled
message RuleEnabled {
  option (confidence.events.v1.event) = {
    persist: true;
    description: "Occurs when a Rule is enabled";
  };
  // The Rule that was enabled
  Flag.Rule rule = 1;
}

// Occurs when a Rule is disabled
message RuleDisabled {
  option (confidence.events.v1.event) = {
    persist: true;
    description: "Occurs when a Rule is disabled";
  };

  // The Rule that was disabled
  Flag.Rule rule = 1;
}


// A materialized segment was created.
message MaterializedSegmentCreated {
  option (confidence.events.v1.event) = {
    persist: true;
    description: "Occurs when a materialized segment is created";
  };
  // The created materialized segment.
  MaterializedSegment materialized_segment = 1;
}

// A materialized segment was updated.
message MaterializedSegmentUpdated {
  option (confidence.events.v1.event) = {
    persist: true;
    description: "Occurs when a materialized segment is updated";
  };
  // The updated materialized segment.
  MaterializedSegment materialized_segment = 1;
}

// A materialized segment was deleted.
message MaterializedSegmentDeleted {
  option (confidence.events.v1.event) = {
    persist: true;
    description: "Occurs when a materialized segment is deleted";
  };
  // The deleted materialized segment.
  string materialized_segment = 1;
}
