syntax = "proto3";
package hashicorp.nomad.plugins.shared.structs;
option go_package = "proto";

import "google/protobuf/wrappers.proto";

// StatObject is a collection of statistics either exposed at the top
// level or via nested StatObjects.
message StatObject {
  // nested is a mapping of object name to a nested stats object.
  map<string, StatObject> nested = 1;

  // attributes is a mapping of statistic name to its value.
  map<string, StatValue> attributes  = 2;
}

// StatValue exposes the values of a particular statistic. The value may
// be of type double, integer, string or boolean. Numeric types can be
// exposed as a single value or as a fraction.
message StatValue {
  // float_numerator_val exposes a floating point value. If denominator
  // is set it is assumed to be a fractional value, otherwise it is a
  // scalar.
  google.protobuf.DoubleValue float_numerator_val = 1;
  google.protobuf.DoubleValue float_denominator_val = 2;

  // int_numerator_val exposes a int value. If denominator
  // is set it is assumed to be a fractional value, otherwise it is a
  // scalar.
  google.protobuf.Int64Value int_numerator_val = 3;
  google.protobuf.Int64Value int_denominator_val = 4;

  // string_val exposes a string value. These are likely annotations.
  google.protobuf.StringValue string_val = 5;

  // bool_val exposes a boolean statistic.
  google.protobuf.BoolValue bool_val = 6;

  // unit gives the unit type: °F, %, MHz, MB, etc.
  string unit = 7;

  // desc provides a human readable description of the statistic.
  string desc = 8;
}
