syntax = "proto3";

import "github.com/gogo/protobuf/gogoproto/gogo.proto";
import "entity.proto";
import "check.proto";
import "metrics.proto";
import "meta.proto";

package sensu.core.v2;

option go_package = "v2";
option (gogoproto.populate_all) = true;
option (gogoproto.equal_all) = true;
option (gogoproto.marshaler_all) = true;
option (gogoproto.unmarshaler_all) = true;
option (gogoproto.sizer_all) = true;
option (gogoproto.testgen_all) = true;

// An Event is the encapsulating type sent across the Sensu websocket transport.
message Event {
  option (gogoproto.face) = true;
  option (gogoproto.goproto_getters) = false;

  // Timestamp is the time in seconds since the Epoch.
  int64 timestamp = 1;

  // Entity describes the entity in which the event occurred.
  Entity entity = 2 [(gogoproto.nullable) = true];

  // Check describes the result of a check; if event is associated to check execution.
  Check check = 3 [(gogoproto.nullable) = true];

  // Metrics are zero or more Sensu metrics
  Metrics metrics = 4 [(gogoproto.nullable) = true];

  // Metadata contains name, namespace, labels and annotations
  ObjectMeta metadata = 5 [(gogoproto.embed) = true, (gogoproto.jsontag) = "metadata", (gogoproto.nullable) = false];
}
