syntax = "proto3";

import "github.com/gogo/protobuf/gogoproto/gogo.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;

// Entity is the Entity supplying the event. The default Entity for any
// Event is the running Agent process--if the Event is sent by an Agent.
message Entity {
  option (gogoproto.face) = true;
  option (gogoproto.goproto_getters) = false;

  string entity_class = 1 [(gogoproto.jsontag) = "entity_class"];
  System system = 3 [(gogoproto.nullable) = false];
  repeated string subscriptions = 4 [(gogoproto.jsontag) = "subscriptions"];
  int64 last_seen = 5 [(gogoproto.jsontag) = "last_seen"];
  bool deregister = 6 [(gogoproto.jsontag) = "deregister"];
  Deregistration deregistration = 7 [(gogoproto.nullable) = false];
  string user = 11;
  // ExtendedAttributes store serialized arbitrary JSON-encoded data
  bytes extended_attributes = 12 [(gogoproto.jsontag) = "-"];
  // Redact contains the fields to redact on the agent
  repeated string redact = 13;
  // Metadata contains the name, namespace, labels and annotations of the entity
  ObjectMeta metadata = 14 [(gogoproto.jsontag) = "metadata,omitempty", (gogoproto.embed) = true, (gogoproto.nullable) = false];
}

// System contains information about the system that the Agent process
// is running on, used for additional Entity context.
message System {
  string hostname = 1;
  string os = 2 [(gogoproto.customname) = "OS"];
  string platform = 3;
  string  platform_family = 4;
  string  platform_version = 5;
  Network network = 6 [(gogoproto.nullable) = false];
  string arch = 7;
}

// Network contains information about the system network interfaces
// that the Agent process is running on, used for additional Entity
// context.
message Network {
  repeated NetworkInterface interfaces = 1 [(gogoproto.jsontag) = "interfaces", (gogoproto.nullable) = false];
}

// NetworkInterface contains information about a system network
// interface.
message NetworkInterface {
  string name = 1;
  string mac = 2 [(gogoproto.customname) = "MAC"];
  repeated string addresses = 3 [(gogoproto.jsontag) = "addresses"];
}

// Deregistration contains configuration for Sensu entity de-registration.
message Deregistration {
  string handler = 1;
}
