// Copyright 2022-2024 ETSI OSG/SDG TeraFlowSDN (TFS) (https://tfs.etsi.org/)
//
// Licensed under the Apache License, Version 2.0 (the "License");
// you may not use this file except in compliance with the License.
// You may obtain a copy of the License at
//
//      http://www.apache.org/licenses/LICENSE-2.0
//
// Unless required by applicable law or agreed to in writing, software
// distributed under the License is distributed on an "AS IS" BASIS,
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
// See the License for the specific language governing permissions and
// limitations under the License.

syntax = "proto3";
package kpi_value_api;

import "context.proto";
import "kpi_manager.proto";

service KpiValueAPIService {
  rpc StoreKpiValues  (KpiValueList     ) returns (context.Empty   ) {}
  rpc SelectKpiValues (KpiValueFilter   ) returns (KpiValueList    ) {}
  rpc GetKpiAlarms    (kpi_manager.KpiId) returns (stream KpiAlarms) {}
}

message KpiValue {
  kpi_manager.KpiId kpi_id         = 1;
  context.Timestamp timestamp      = 2;
  KpiValueType      kpi_value_type = 3;
}

message KpiValueList {
  repeated KpiValue kpi_value_list = 1;
}

message KpiValueType {
  oneof value {
    int32  int32Val  = 1;
    uint32 uint32Val = 2;
    int64  int64Val  = 3;
    uint64 uint64Val = 4;
    float  floatVal  = 5;
    string stringVal = 6;
    bool   boolVal   = 7;
  }
}

message KpiValueFilter {
  repeated kpi_manager.KpiId kpi_id          = 1;
  repeated context.Timestamp start_timestamp = 2;
  repeated context.Timestamp end_timestamp   = 3;
}

message KpiAlarms {
  context.Timestamp start_timestamp = 1;
  context.Timestamp end_timestamp   = 2;
  kpi_manager.KpiId kpi_id          = 3;
  map<string, bool> alarms          = 4;
}
