syntax = "proto3";
package monitoring;

import "context.proto";
import "kpi_sample_types.proto";

service MonitoringService {
  rpc CreateKpi       (KpiDescriptor    ) returns (KpiId        ) {}
  rpc GetKpiDescriptor(KpiId            ) returns (KpiDescriptor) {}
  rpc IncludeKpi      (Kpi              ) returns (context.Empty) {}
  rpc MonitorKpi      (MonitorKpiRequest) returns (context.Empty) {}
  rpc GetStreamKpi    (KpiId            ) returns (stream Kpi   ) {}
  rpc GetInstantKpi   (KpiId            ) returns (Kpi          ) {}
}

message KpiDescriptor {
  string kpi_description = 1;
  kpi_sample_types.KpiSampleType kpi_sample_type = 2;
  context.DeviceId device_id = 3;
  context.EndPointId endpoint_id = 4;
  context.ServiceId  service_id  = 5;
//  context.SliceId    slice_id    = 6;
}

message MonitorKpiRequest{
  KpiId kpi_id = 1;
  float sampling_duration_s = 2;
  float sampling_interval_s = 3;
}

message KpiId {
  context.Uuid kpi_id = 1;
}

message Kpi {
  KpiId kpi_id = 1;
  string timestamp = 2;
  KpiValue kpi_value = 4;
}

message KpiValue {
  oneof value {
    uint32 intVal = 1;
    float floatVal = 2;
    string stringVal = 3;
    bool boolVal = 4;
  }
}

message KpiList {
  repeated Kpi kpi_list = 1;
}
