// ©2023, ANSYS Inc. Unauthorized use, distribution or duplication is prohibited.
syntax = "proto3";
package ansys.api.geometry.v0.Bodies;

import "ansys/api/geometry/v0/models.proto";

option csharp_namespace = "Ansys.Api.Geometry.V0.Bodies";

service Bodies
{
  rpc Get(GetRequest) returns(Body);

  rpc GetMaster(EntityIdentifier) returns(Body); 

  rpc GetOriginal(EntityIdentifier) returns(Body);

  rpc GetParent(EntityIdentifier) returns(Part);

  rpc GetAll(GetAllRequest) returns(GetAllResponse) ;

  rpc GetAssignedMaterial(EntityIdentifier) returns(Material);

  rpc SetAssignedMaterial(SetAssignedMaterialRequest) returns(SetAssignedMaterialResponse);

  rpc Translate(TranslateRequest) returns(Empty);

  rpc GetFaces(EntityIdentifier) returns (GetFacesResponse);
  
  rpc CreateBodyFromFace(CreateBodyFromFaceRequest) returns (Body);
  
  rpc CreateExtrudedBodyFromFaceProfile(CreateExtrudedBodyFromFaceProfileRequest) returns (Body);
  
  rpc Delete(EntityIdentifier) returns (Empty);

  rpc CreatePlanarBody(CreatePlanarBodyRequest) returns (Body);

  rpc CreateExtrudedBody(CreateExtrudedBodyRequest) returns (Body);

  rpc GetVolume(EntityIdentifier) returns(GetVolumeResponse);

  rpc GetTessellation(EntityIdentifier) returns(GetTessellationResponse);

  rpc GetEdges(EntityIdentifier) returns (GetEdgesResponse);

  rpc GetName(EntityIdentifier) returns (GetNameResponse);

  rpc Copy(CopyRequest) returns (Body);

  rpc GetUpdateState(EntityIdentifier) returns (UpdateState);

  rpc Boolean(BooleanRequest) returns (BooleanResponse);
}

message BooleanRequest {
  string body1 = 1;
  string body2 = 2;
  string method = 3;
}

message BooleanResponse {
  int32 empty_result = 1;
}

enum GetType{
  NONE = 0;
  MASTER = 1;
  ORIGINAL = 2;
  PARENT=3;
}

message GetRequest{
  string id = 1;
  GetType body_type = 2;
}

message GetAllRequest{
  string parent = 1;
}

message GetAllResponse{
  repeated Body bodies = 1;
}

message SetAssignedMaterialRequest{
  string id=1;
  string material=2;
}

message SetAssignedMaterialResponse{
  Material material=1;
}

message TranslateRequest{
  repeated string ids=1;
  Direction direction=2;
  float distance=3;
}

message GetFacesResponse {
  repeated Face faces=1;
}

message CreateBodyFromFaceRequest {
  string name=1;
  string parent=2;
  string face=3;
}

message CreateExtrudedBodyFromFaceProfileRequest {
  string name=1;
  string parent=2;
  string face=3;
  double distance=4;
}

message CreatePlanarBodyRequest {
  string name=1;
  string parent=2;
  Plane plane=3;
  Geometries geometries=4;
}

message CreateExtrudedBodyRequest {
  string name=1;
  string parent=2;
  Plane plane=3;
  Geometries geometries=4;
  double distance=5;
}

message GetVolumeResponse {
  double volume=1;
}

message GetTessellationResponse{
  map<string, Tessellation> face_tessellation=1;
}

message GetEdgesResponse {
  repeated Edge edges=1;
}

message GetNameResponse {
  string name=1;
}

message CopyRequest {
  string id=1;
  string parent=2;
  string name=3;
}