// Proto file containing commonly used messages

syntax = "proto3";

package ansys.api.edb.v1;

import public "google/protobuf/wrappers.proto";
import public "google/protobuf/empty.proto";
import public "google/protobuf/any.proto";

import "ansys/api/edb/v1/edb_defs.proto";

//------------------------------------------------------------------------------
// Value

message ComplexMessage {
  double real = 1;
  double imag = 2;
}

message ValueMessage {
  string text = 1;
  oneof _val {
    ComplexMessage constant = 2;
	EDBObjMessage variable_owner = 3;
  }
}

//------------------------------------------------------------------------------
// Cell

message DesignModeMessage {
  DesignMode mode = 1;
}

message DesignModePropertyMessage {
  EDBObjMessage target = 1;
  DesignMode mode = 2;
}

//------------------------------------------------------------------------------
// Temperature Settings

message TemperatureSettingsMessage {
  ValueMessage temperature = 1;
  bool include_temp_dependence = 2;
  bool enable_thermal_feedback = 3;
}

//------------------------------------------------------------------------------
// HFSS Extents

message HfssExtentMessage {
  double value = 1;
  bool absolute = 2;
}

message HfssExtentInfoMessage {
  bool use_open_region = 1;
  HfssExtentsType extent_type = 2;
  HfssExtentsOpenRegionType open_region_type = 3;
  EDBObjMessage base_polygon = 4;
  HfssExtentsType dielectric_extent_type = 5;
  EDBObjMessage dielectric_base_polygon = 6;
  HfssExtentMessage dielectric = 7;
  bool honor_user_dielectric = 8;
  bool airbox_truncate_at_ground = 9;
  HfssExtentMessage airbox_horizontal = 10;
  HfssExtentMessage airbox_vertical_positive = 11;
  HfssExtentMessage airbox_vertical_negative = 12;
  bool sync_airbox_vertical_extent = 13;
  bool is_pml_visible = 14;
  ValueMessage operating_frequency = 15;
  ValueMessage radiation_level = 16;
  bool user_xy_data_extent_for_vertical_expansion = 17;
}

//------------------------------------------------------------------------------
// Component

message ComponentTypeMessage {
  ComponentType comp_type = 1;
}

//------------------------------------------------------------------------------
// Helpers

message EDBObjMessage {
  uint64 impl_ptr_address = 1;
  uint64 id = 2;
  EdbObjCacheMessage cache = 3;
}

// Message containing a collection of edb objects 
message EDBObjCollectionMessage {
  repeated EDBObjMessage items = 1;
}

// Message representing an arbitrary edb object and a name
message EDBObjNameMessage {
  EDBObjMessage target = 1;
  string name = 2;
}

message IntPropertyMessage {
  EDBObjMessage target = 1;
  int64 value = 2;
}

message BoolPropertyMessage {
  EDBObjMessage target = 1;
  bool value = 2;
}

message StringPropertyMessage {
  EDBObjMessage target = 1;
  string value = 2;
}

message PointerPropertyMessage {
  EDBObjMessage target = 1;
  EDBObjMessage value = 2;
}

message ProductPropertyIdMessage {
  ProductIdType product_id = 1;
  uint64 attribute_id = 2;
}

message GetProductPropertyMessage {
  EDBObjMessage edb_obj = 1;
  ProductPropertyIdMessage product_prop_id = 2;
}
  
message DoublePropertyMessage {
  EDBObjMessage target = 1;
  double value = 2;
}

message ValuePropertyMessage {
  EDBObjMessage target = 1;
  ValueMessage value = 2;
}

message SetProductPropertyMessage {
  EDBObjMessage edb_obj = 1;
  ProductPropertyIdMessage product_prop_id = 2;
  string property_value = 3;
}

message GetProductPropertyIdsMessage {
  EDBObjMessage edb_obj = 1;
  ProductIdType product_id = 2;
}

message ProductPropertyIdsMessage {
  repeated uint64 ids = 1;
}

message IntegersPropertyMessage {
  repeated uint64 props = 1;
}

message EDBInternalIdMessage {
  uint64 id = 1;
}

message StringsMessage {
  repeated string strings = 1;
}

message StringsPropertyMessage {
  EDBObjMessage edb_obj = 1;
  repeated string strings = 2;
}

message EDBObjPairMessage {
  EDBObjMessage edb_obj_0 = 1;
  EDBObjMessage edb_obj_1 = 2;
}

message StringPairMessage {
  string first = 1;
  string second = 2;
}

message StringPairsMessage {
  repeated StringPairMessage pairs = 1;
}

message StringPairPropertyMessage {
  EDBObjMessage target = 1;
  StringPairMessage values = 2;
}

message ValuePairMessage {
  ValueMessage val1 = 1;
  ValueMessage val2 = 2;
}

message ValuePairPropertyMessage {
  EDBObjMessage target = 1;
  ValuePairMessage values = 2;
}

message UInt64PropertyMessage {
  EDBObjMessage target = 1;
  uint64 value = 2;
}

message DoublesMessage {
  repeated double doubles = 1;
}

message DoublesPropertyMessage {
  EDBObjMessage edb_obj = 1;
  repeated double doubles = 2;
}

message AnyModuleMessage {
  google.protobuf.Any any = 1;
  string module = 2;
}

message EdbObjCacheEntryMessage {
  AnyModuleMessage request = 1;
  AnyModuleMessage response = 2;
  string service_name = 3;
  string rpc_method_name = 4;
}

message EdbObjCacheMessage {
  repeated EdbObjCacheEntryMessage cache = 1;
}