/**
* @file OAM_datastruct.proto
* @brief TDSCmd define
* @author YueWang
* @version 1.0
* @date 2022-09-23
*/
syntax = "proto3";
//import "google/protobuf/any.proto";
option go_package = "../protogo";
import "google/protobuf/timestamp.proto";
import "TDSCmd.proto";

//alrm level
enum  Level{
  Defaul_Level = 0; //告警级别非下列两种时为0
  Normal_Alarm = 1;
  Critical_Alarm = 2;
}
//log level
enum  LogLevel{
  Default_LogLevel = 0;  //log级别非下列三种时为0
  Normal = 1;
  Warning = 2;
  Error = 3;
}

enum OperandType {
  _DEFAULT = 0;  //数值不是下列几种情况时，为0
  _UINT = 1;
  _INT = 2;
  _STRING = 3;
  _FLOAT = 4;
  _DOUBLE = 5;
}

// operator 
enum Operator{
  Default_Operator = 0;  //操作符为空时，Default_Operator为0
  GreaterThan = 1;
  GreaterThanOrEqualTo = 2;
  EqualTo = 3;
  LessThan = 4;
  LessThanOrEqualTo = 5;
  NotEqualTo = 6;
}

enum RelationOperator {
  Default_RelationOperator = 0; //关系符为空时，Default_RelationOperator为0
  AND = 1;
  OR = 2;
}

//message return back to device when OAM receive the alarm info from device
message DeviceRet{
  uint32 AlarmID = 1;//这个就OAM会用到
  uint32 StationID = 2;
  uint32 DeviceID = 3;
  CodeValue CodeRet = 4;
  string  Message = 5;
}

//normal message respond back to UI OR Lower OAM   
message Respond{
  CodeValue CodeRet = 1;
  string  Message = 2;
}

//StationID is SUID of device，DeviceID is the sub device
message StationDevID{
  uint32 StationID = 1;
  uint32 DeviceID = 2;
}

//alarm attribution
message AlarmAttri
{
  uint32 Id = 1;
  uint32 AlarmID = 2;
  Level  AlarmLevel = 3;
  string AlarmDescriptionCHN = 4;
  string AlarmDescriptionENG = 5;
  uint32 IsMon = 6;
  google.protobuf.Timestamp CreateTime = 7;
}
//performance attribution
message PerAttri
{
  uint32 Id = 1;
  uint32 PerID = 2;
  string DataCatlog = 3;
  string FieldName = 4;
  string PerDescriptionCHN = 5;
  string PerDescriptionENG = 6;
  OperandType FieldType = 7;
  string FieldUnit = 8;
  Operator Operator1 = 9;
  string Operand1 = 10;
  RelationOperator Relation = 11;
  Operator Operator2 = 12;
  string Operand2 = 13;
  uint32 IsMon = 14;
  Level PerAlarmLevel = 15;
  string AlarmDesCHN = 16;
  string AlarmDesENG = 17;
  google.protobuf.Timestamp CreateTime = 18;
}

//current alarm
message CurrAlarm
{
  uint32 Id = 1;
  uint32 AlarmID = 2;
  uint32 StationID = 3;
  uint32 DeviceID = 4;
  Level AlarmLevel = 5;
  string AlarmDescriptionCHN = 6;
  string AlarmDescriptionENG = 7;
  google.protobuf.Timestamp ReportTime = 8;
}
// history of alarm
message HisAlarm
{
  uint32 Id = 1;
  uint32 AlarmID = 2;
  uint32 StationID = 3;
  uint32 DeviceID = 4;
  Level  AlarmLevel = 5;
  string AlarmDescriptionCHN = 6;
  string AlarmDescriptionENG = 7;
  google.protobuf.Timestamp StartTime = 8;
  google.protobuf.Timestamp EndTime = 9;

}

message SysStatus
{
  uint32 StationID = 1;
  uint32 DeviceID = 2;
  Devistatus Status = 3;
  google.protobuf.Timestamp ReportTime = 4;
}

message Log{
  uint32 StationID = 1;
  uint32 DeviceID = 2;
  LogLevel  Loglevel = 3;
  string LogInfoCHN = 4;
  string LogInfoENG = 5;
  string Manipunator = 6;
  google.protobuf.Timestamp ReportTime = 7 ;
}

message PerInfo{
  uint32 Id = 1;
  uint32 PerID = 2;
  uint32 StationID = 3;
  uint32 DeviceID = 4;
  string DataCatlog = 5;
  string FieldName = 6;
  string FieldValue = 7;
  string PerDescriptionCHN = 8;
  string PerDescriptionENG = 9;
  google.protobuf.Timestamp UpdateTime = 10 ;
}

message PerRequire{
  string DataCatlog = 1;
  string FieldName = 2;
  uint32 IsMon = 3;
}

