syntax = "proto3";
    option go_package = "./artifacts/academy-server/release-tsjs/modules/iot";

import "artifacts/academy-server/release-tsjs/core/common.proto";




  

  

  
      
service DataNodes {
  rpc DataNodeActionCreate (DataNodeEntity) returns (DataNodeCreateReply) {}
  rpc DataNodeActionUpdate (DataNodeEntity) returns (DataNodeCreateReply) {}

  rpc DataNodeActionQuery (QueryFilterRequest) returns (DataNodeQueryReply) {}
  rpc DataNodeActionGetOne (QueryFilterRequest) returns (DataNodeReply) {}
  rpc DataNodeActionRemove (QueryFilterRequest) returns (RemoveReply) {}
}

message DataNodeCreateReply {
	DataNodeEntity data  = 1;
	IError error = 2;
}

message DataNodeReply {
	DataNodeEntity data = 1;
	IError error = 2;
}

message DataNodeQueryReply {
	repeated DataNodeEntity items = 1;
	int64 totalItems = 2;
	int64 itemsPerPage = 3;
	int64 startIndex = 4;
	IError error = 5;
}



;





 
message DataNodeEntity {
  optional string visibility = 1; // @tag(yaml:"visibility")
  optional string workspaceId = 2; // @tag(yaml:"workspaceId")
  optional string linkerId = 3; // @tag(yaml:"linkerId")
  optional string parentId = 4; // @tag(yaml:"parentId")
  string uniqueId = 5; // @tag(gorm:"primarykey;uniqueId;unique;not null;size:100;" yaml:"uniqueId")
  optional string userId = 6; // @tag(yaml:"userId")
  optional string name = 8; // @tag(  yaml:"name"  )

  optional string value = 9; // @tag(  yaml:"value"  )

  /* One 2 one to external entity */
  optional string typeId  = 11; // @tag(yaml:"typeId" )
  DataNodeTypeEntity type = 12; // @tag(gorm:"foreignKey:TypeId;references:UniqueId" json:"type" yaml:"type")

  /* This is an object, another entity needs to be created for */
  /*repeated DataNodeReadersEntity readers = 13; // @tag(gorm:"foreignKey:LinkerId;references:UniqueId" yaml:"readers")*/
  repeated DataNodeReadersEntity readers = 13; // @tag(gorm:"foreignKey:LinkerId;references:UniqueId" yaml:"readers")

  /* This is an object, another entity needs to be created for */
  /*repeated DataNodeWritersEntity writers = 14; // @tag(gorm:"foreignKey:LinkerId;references:UniqueId" yaml:"writers")*/
  repeated DataNodeWritersEntity writers = 14; // @tag(gorm:"foreignKey:LinkerId;references:UniqueId" yaml:"writers")

  int64 rank = 15; // @tag(gorm:"type:int;name:rank")
  int64 updated = 16; // @tag(gorm:"autoUpdateTime:nano")
  int64 created = 17; // @tag(gorm:"autoUpdateTime:nano")
  string createdFormatted = 18; // @tag(sql:"-")
  string updatedFormatted = 19; // @tag(sql:"-")

}









 
message DataNodeReadersEntity {
  optional string visibility = 1; // @tag(yaml:"visibility")
  optional string workspaceId = 2; // @tag(yaml:"workspaceId")
  optional string linkerId = 3; // @tag(yaml:"linkerId")
  optional string parentId = 4; // @tag(yaml:"parentId")
  string uniqueId = 5; // @tag(gorm:"primarykey;uniqueId;unique;not null;size:100;" yaml:"uniqueId")
  optional string userId = 6; // @tag(yaml:"userId")
  optional string fn = 8; // @tag(  yaml:"fn"  )

  int64 rank = 9; // @tag(gorm:"type:int;name:rank")
  int64 updated = 10; // @tag(gorm:"autoUpdateTime:nano")
  int64 created = 11; // @tag(gorm:"autoUpdateTime:nano")
  string createdFormatted = 12; // @tag(sql:"-")
  string updatedFormatted = 13; // @tag(sql:"-")

}









 
message DataNodeWritersEntity {
  optional string visibility = 1; // @tag(yaml:"visibility")
  optional string workspaceId = 2; // @tag(yaml:"workspaceId")
  optional string linkerId = 3; // @tag(yaml:"linkerId")
  optional string parentId = 4; // @tag(yaml:"parentId")
  string uniqueId = 5; // @tag(gorm:"primarykey;uniqueId;unique;not null;size:100;" yaml:"uniqueId")
  optional string userId = 6; // @tag(yaml:"userId")
  optional string fn = 8; // @tag(  yaml:"fn"  )

  int64 rank = 9; // @tag(gorm:"type:int;name:rank")
  int64 updated = 10; // @tag(gorm:"autoUpdateTime:nano")
  int64 created = 11; // @tag(gorm:"autoUpdateTime:nano")
  string createdFormatted = 12; // @tag(sql:"-")
  string updatedFormatted = 13; // @tag(sql:"-")

}









/**
* Add your custom services, and messages here.
* It can be your dto for example. 
* - Use Module.yml for entities, otherwise it won't be managed
* - Don't use this file for entities might be queried by web
**/
      
message WriteDatumDto {
    string uniqueId = 1;
    optional int64 valueInt64 = 2;
    optional double valueFloat64 = 3;
    optional string valueString = 4 ;

}



  

  

  
      
service DataNodeTypes {
  rpc DataNodeTypeActionCreate (DataNodeTypeEntity) returns (DataNodeTypeCreateReply) {}
  rpc DataNodeTypeActionUpdate (DataNodeTypeEntity) returns (DataNodeTypeCreateReply) {}

  rpc DataNodeTypeActionQuery (QueryFilterRequest) returns (DataNodeTypeQueryReply) {}
  rpc DataNodeTypeActionGetOne (QueryFilterRequest) returns (DataNodeTypeReply) {}
  rpc DataNodeTypeActionRemove (QueryFilterRequest) returns (RemoveReply) {}
}

message DataNodeTypeCreateReply {
	DataNodeTypeEntity data  = 1;
	IError error = 2;
}

message DataNodeTypeReply {
	DataNodeTypeEntity data = 1;
	IError error = 2;
}

message DataNodeTypeQueryReply {
	repeated DataNodeTypeEntity items = 1;
	int64 totalItems = 2;
	int64 itemsPerPage = 3;
	int64 startIndex = 4;
	IError error = 5;
}







 
message DataNodeTypeEntity {
  optional string visibility = 1; // @tag(yaml:"visibility")
  optional string workspaceId = 2; // @tag(yaml:"workspaceId")
  optional string linkerId = 3; // @tag(yaml:"linkerId")
  optional string parentId = 4; // @tag(yaml:"parentId")
  string uniqueId = 5; // @tag(gorm:"primarykey;uniqueId;unique;not null;size:100;" yaml:"uniqueId")
  optional string userId = 6; // @tag(yaml:"userId")
  optional string name = 8; // @tag(  yaml:"name"  )

  int64 rank = 9; // @tag(gorm:"type:int;name:rank")
  int64 updated = 10; // @tag(gorm:"autoUpdateTime:nano")
  int64 created = 11; // @tag(gorm:"autoUpdateTime:nano")
  string createdFormatted = 12; // @tag(sql:"-")
  string updatedFormatted = 13; // @tag(sql:"-")

}









/**
* Add your custom services, and messages here.
* It can be your dto for example. 
* - Use Module.yml for entities, otherwise it won't be managed
* - Don't use this file for entities might be queried by web
**/
      




  

  

  
      
service NodeDatums {
  rpc NodeDatumActionCreate (NodeDatumEntity) returns (NodeDatumCreateReply) {}
  rpc NodeDatumActionUpdate (NodeDatumEntity) returns (NodeDatumCreateReply) {}

  rpc NodeDatumActionQuery (QueryFilterRequest) returns (NodeDatumQueryReply) {}
  rpc NodeDatumActionGetOne (QueryFilterRequest) returns (NodeDatumReply) {}
  rpc NodeDatumActionRemove (QueryFilterRequest) returns (RemoveReply) {}
}

message NodeDatumCreateReply {
	NodeDatumEntity data  = 1;
	IError error = 2;
}

message NodeDatumReply {
	NodeDatumEntity data = 1;
	IError error = 2;
}

message NodeDatumQueryReply {
	repeated NodeDatumEntity items = 1;
	int64 totalItems = 2;
	int64 itemsPerPage = 3;
	int64 startIndex = 4;
	IError error = 5;
}



;





 
message NodeDatumEntity {
  optional string visibility = 1; // @tag(yaml:"visibility")
  optional string workspaceId = 2; // @tag(yaml:"workspaceId")
  optional string linkerId = 3; // @tag(yaml:"linkerId")
  optional string parentId = 4; // @tag(yaml:"parentId")
  string uniqueId = 5; // @tag(gorm:"primarykey;uniqueId;unique;not null;size:100;" yaml:"uniqueId")
  optional string userId = 6; // @tag(yaml:"userId")
  /* One 2 one to external entity */
  optional string nodeId  = 9; // @tag(yaml:"nodeId" )
  DataNodeEntity node = 10; // @tag(gorm:"foreignKey:NodeId;references:UniqueId" json:"node" yaml:"node")

  optional double valueFloat64 = 11; // @tag(  yaml:"valueFloat64"  )

  optional int64 valueInt64 = 12; // @tag(  yaml:"valueInt64"  )

  optional string valueString = 13; // @tag(  yaml:"valueString"  )

  int64 ingestedAt = 15;
  string ingestedAtFormatted = 16;

  int64 rank = 17; // @tag(gorm:"type:int;name:rank")
  int64 updated = 18; // @tag(gorm:"autoUpdateTime:nano")
  int64 created = 19; // @tag(gorm:"autoUpdateTime:nano")
  string createdFormatted = 20; // @tag(sql:"-")
  string updatedFormatted = 21; // @tag(sql:"-")

}









/**
* Add your custom services, and messages here.
* It can be your dto for example. 
* - Use Module.yml for entities, otherwise it won't be managed
* - Don't use this file for entities might be queried by web
**/
      


