// Copyright 2023 ANSYS, Inc. Unauthorized use, distribution, or duplication is prohibited.
syntax = "proto3";

import "ansys/api/sherlock/v0/SherlockCommonService.proto";

option java_package = "sherlock.grpc";
option java_outer_classname = "SherlockLayerServiceProto";

/**
 * Request to list the valid mount point types.
 */
message GetMountPointTypesRequest {
}

/**
 * Represents a list of valid mount point types.
 */
message GetMountPointTypesResponse {
  ReturnCode returnCode 	= 1;	// Status code of response.
  repeated string type 		= 2;	// Mount Point Type.
}

/**
 * Request to list the valid mount point shape types.
 */
message GetMountPointShapeTypesRequest {
  string mountPointType		= 1;	// Mount Point Type. Supported values are: Mount Hole, Mount Pad, Standoff, and Support Pin.
}

/**
 * Represents a list of valid mount point shape types.
 */
message GetMountPointShapeTypesResponse {
  ReturnCode returnCode 	= 1;	// Status code of response.
  repeated string type 		= 2;	// Mount Point Shape Type.
}

/**
 * Request to list the valid mount point sides.
 */
message GetMountPointSidesRequest {
}

/**
 * Represents a list of valid mount point sides.
 */
message GetMountPointSidesResponse {
  ReturnCode returnCode		= 1;	// Status code of response.
  repeated string side		= 2;	// Mount Point side.
}

/**
 * Request to list the valid mount point units.
 */
message GetMountPointUnitsRequest {
}

/**
 * Represents a list of valid mount point units.
 */
message GetMountPointUnitsResponse {
  ReturnCode returnCode 	= 1;	// Status code of response.
  repeated string units		= 2;	// Mount Point units.
}

/**
 * Request to list the valid mount point boundaries.
 */
message GetMountPointBoundariesRequest {
}

/**
 * Represents a list of valid mount point boundaries.
 */
message GetMountPointBoundariesResponse {
  ReturnCode returnCode 	= 1;	// Status code of response.
  repeated string boundary	= 2;	// Mount Point boundary.
}

/**
 * Request to list the valid mount point chassis materials.
 */
message GetMountPointChassisMaterialsRequest {
}

/**
 * Represents a list of valid mount point chassis materials.
 */
message GetMountPointChassisMaterialsResponse {
  ReturnCode returnCode 			= 1;	// Status code of response.
  repeated string chassisMaterial	= 2;	// Mount Point chassis material.
}

/**
 * Request to delete all mount points in specific CCA of specific project.
 */
message DeleteAllMountPointsRequest {
  string project = 1;	// Sherlock project name.
  string ccaName = 2;	// The CCA name.
}

/**
 * Request to export all mount points and their properties into a CSV formatted file.
 */
message ExportAllMountPointsRequest {
  string project 	= 1;	// Sherlock project name.
  string ccaName 	= 2;	// The CCA name.
  string units 		= 3;	// Units used in exporting.
  string filePath 	= 4;	// The filepath of the CSV file to be exported.
}

/**
 * Request to export all ICT fixtures and their properties into a CSV formatted file.
 */
message ExportAllICTFixturesRequest {
  string project 	= 1;	// Sherlock project name.
  string ccaName 	= 2;	// The CCA name.
  string units 		= 3;	// Units used in exporting.
  string filePath 	= 4;	// The filepath of the CSV file to be exported.
}

/**
 * Request to list the valid mount point chassis materials.
 */
message GetMountPointsPropertiesRequest {
  string project				= 1;	// Sherlock project name.
  string ccaName				= 2;	// The CCA name.
  string mountPointIDs			= 3;	// A comma separated list of mount point id for a list of mount point, or a mount id for one part.
}

/**
 * Represents a list of valid mount point properties.
 */
message GetMountPointsPropertiesResponse {
  ReturnCode returnCode 		= 1;	// Status code of response.
  repeated MountPointProperties mountPointsProperties 	= 2;	// Mount point properties.
}

/**
 * Properties of mount point, the properties may varies from the mount point type and mount point shape.
 */	
message MountPointProperties{
  string ID					= 1;	// Mount point ID.
  string type				= 2;	// Mount point type.
  string shape				= 3;	// Shape type.
  string units 				= 4;	// Mount point units.
  string x 					= 5;	// Center X.
  string y 					= 6;	// Center Y.
  string length 			= 7;	// Length.
  string width				= 8;	// Width.
  string diameter			= 9;	// Diameter.
  string nodes				= 10;	// # of nodes.
  string rotation			= 11;	// Rotation in degrees.
  string side 				= 12;	// Mount point side.
  string height 			= 13;	// Mount point height.
  string material 			= 14;	// Mount point material.
  string boundary			= 15;	// Boundary Pt(s).
  string constraints		= 16; 	// FEA constraints.
  string polygon			= 17;	// Coordinates of points.
  string state				= 18;	// Mount point state.
  string chassisMaterial 	= 19;	// Chassis material.
}

/**
 * Request to update mount points properties of a CCA from a CSV formatted file.
 */
message UpdateMountPointsByFileRequest {
  string project 										= 1;	// Sherlock project name.
  string ccaName 										= 2;	// The CCA name.
  string filePath 										= 3;	// The filepath of the CSV file containing the mount points properties.
}

/**
 * Request to update mount points properties of a CCA from a CSV formatted file.
 */
message UpdateMountPointsRequest {
  string project 										= 1;	// Sherlock project name.
  string ccaName 										= 2;	// The CCA name.
  repeated MountPointProperties mountPointsProperties 	= 3;	// Mount point properties.
}

/**
 * Contains the status of the update as well as all the update error messages.
 */
message UpdateMountPointsResponse {
  ReturnCode returnCode 		= 1;	// Status code of response.
  repeated string updateError	= 2;	// Mount Points update error messages.
}

/**
 * Request to delete all ICT fixtures in specific CCA of specific project.
 */
message DeleteAllICTFixturesRequest {
  string project = 1;	// Sherlock project name.
  string ccaName = 2;	// The CCA name.
}

/**
 * Request to delete all ICT fixtures in specific CCA of specific project.
 */
message DeleteAllTestPointsRequest {
  string project = 1;	// Sherlock project name.
  string ccaName = 2;	// The CCA name.
}

/**
 * Request to update ICT fixtures properties of a CCA from a CSV formatted file.
 */
message UpdateICTFixturesByFileRequest {
  string project 										= 1;	// Sherlock project name.
  string ccaName 										= 2;	// The CCA name.
  string filePath 										= 3;	// The filepath of the CSV file containing the ICT fixtures properties.
}

/**
 * Contains the status of the update as well as all the update error messages.
 */
message UpdateICTFixturesResponse {
  ReturnCode returnCode 		= 1;	// Status code of response.
  repeated string updateError	= 2;	// ICT fixtures update error messages.
}

/**
 * Request to export all test points and their properties into a CSV formatted file.
 */
message ExportAllTestPointsRequest {
  string project 		= 1;	// Sherlock project name.
  string ccaName 		= 2;	// The CCA name.
  string lengthUnits 	= 3;	// Length Units used in exporting.
  string displacementUnits = 4;	// Displacement Units used in exporting.
  string forceUnits 	= 5;	// Force Units used in exporting.
  string filePath 		= 6;	// The filepath of the CSV file to be exported.
}

/**
 * Request to update test points properties of a CCA from a CSV formatted file.
 */
message UpdateTestPointsByFileRequest {
  string project 										= 1;	// Sherlock project name.
  string ccaName 										= 2;	// The CCA name.
  string filePath 										= 3;	// The filepath of the CSV file containing the test points properties.
}

/**
 * Contains the status of the update as well as all the update error messages.
 */
message UpdateTestPointsResponse {
  ReturnCode returnCode 		= 1;	// Status code of response.
  repeated string updateError	= 2;	// Test Points update error messages.
}

message PolygonalShape {
    
  message Point {
    double x = 1;					// The x coordinate of the point.
    double y = 2;					// The y coordinate of the point.
  }
    
  repeated Point points = 1;		// The points used to define the polygonal shape, must be >= 3.
  optional double rotation = 2;		// The rotation of the shape in degrees.
}
  
message RectangularShape {
  optional double length = 1;		// The length of the rectangle.
  optional double width = 2;		// The width of the rectangle.
  optional double centerX = 3;		// The x coordinate of the center of the rectangle.
  optional double centerY = 4;		// The y coordinate of the center of the rectangle.
  optional double rotation = 5;		// The rotation of the rectangle in degrees.
}
  
message SlotShape {
  optional double length = 1;		// The length of the slot shape.
  optional double width = 2;		// The width of the slot shape.
  optional uint32 nodeCount = 3;	// The number of nodes.
  optional double centerX = 4;		// The x coordinate of the center of the slot shape.
  optional double centerY = 5;		// The x coordinate of the center of the slot shape.
  optional double rotation = 6;		// The rotation of the shape in degrees.
}
  
message CircularShape {
  optional double diameter = 1;		// The diameter of the circle.
  optional uint32 nodeCount = 2;	// The number of nodes.
  optional double centerX = 3;		// The x coordinate of the center of the circle.
  optional double centerY = 4;		// The x coordinate of the center of the circle.
  optional double rotation = 5;		// The rotation of the shape in degrees.
}
  
message PCBShape {
}

/**
 * Request to add a potting region.
 */
message AddPottingRegionRequest {  
  message PottingRegion {
    string ccaName = 1;							// The name of the CCA.
    optional string pottingID = 2;				// The potting ID, must be unique.
    optional string pottingSide = 3;			// The potting side, options are "TOP", "BOT", or "BOTTOM".
    optional string pottingMaterial = 4;		// The potting material.
    optional string pottingUnits = 5;			// The units to use for the potting region.
    optional double pottingThickness = 6;		// The potting thickness.
    optional double pottingStandoff = 7;		// The potting standoff.
  
    oneof Shape {
      PolygonalShape polygonalShape = 8;		// Used to add a region with a polygonal shape.
  	  RectangularShape rectangularShape = 9;	// Used to add a region with a rectangular shape.
  	  SlotShape slotShape = 10;					// Used to add a region with a slot shape.
  	  CircularShape circularShape = 11;			// Used to add a region with a circular shape.
  	  PCBShape pCBShape = 12;					// Used to add a region with a PCB shape.
    }
  }
  
  string project = 1;							// The name of the Sherlock project to add the potting regions to.
  repeated PottingRegion pottingRegions = 2;	// The potting regions to add.
}

service SherlockLayerService {
  // Add a potting region with the specified shape and properties.
  rpc addPottingRegion(AddPottingRegionRequest) returns (ReturnCode);

  // Delete all ICT fixtures in specific CCA of specific project.
  rpc deleteAllICTFixtures(DeleteAllICTFixturesRequest) returns (ReturnCode);

  // Delete all mount points in specific CCA of specific project.
  rpc deleteAllMountPoints(DeleteAllMountPointsRequest) returns (ReturnCode);
  
  // Delete all test points in specific CCA of specific project.
  rpc deleteAllTestPoints(DeleteAllTestPointsRequest) returns (ReturnCode);
  
  // Export all mount points and their properties into a CSV formatted file.
  rpc exportAllMountPoints(ExportAllMountPointsRequest) returns (ReturnCode);
  
  // Export all ICT fixtures and their properties into a CSV formatted file.
  rpc exportAllICTFixtures(ExportAllICTFixturesRequest) returns (ReturnCode);

  // Export all test points and their properties into a CSV formatted file.
  rpc exportAllTestPoints(ExportAllTestPointsRequest) returns (ReturnCode);

  // Get a list of valid mount point boundaries.
  rpc getMountPointBoundaries(GetMountPointBoundariesRequest) returns (GetMountPointBoundariesResponse);

  // Get a list of valid mount point chassis materials.
  rpc getMountPointChassisMaterials(GetMountPointChassisMaterialsRequest) returns (GetMountPointChassisMaterialsResponse);
  
  // Get a list of valid mount point properties.
  rpc getMountPointsProperties(GetMountPointsPropertiesRequest) returns (GetMountPointsPropertiesResponse);

  // Get a list of valid mount point shape type values.
  rpc getMountPointShapeTypes(GetMountPointShapeTypesRequest) returns (GetMountPointShapeTypesResponse);
  
  // Get a list of valid mount point sides.
  rpc getMountPointSides(GetMountPointSidesRequest) returns (GetMountPointSidesResponse);

  // Get a list of valid mount point type values.
  rpc getMountPointTypes(GetMountPointTypesRequest) returns (GetMountPointTypesResponse);

  // Get a list of valid mount point units.
  rpc getMountPointUnits(GetMountPointUnitsRequest) returns (GetMountPointUnitsResponse);
  
  // Update the ICT fixtures properties of a CCA from a CSV formatted file. This API could be used to add new ICT fixtures or update existing ones depending on the file contents.
  // If the ID specified already exists, then the properties for that ICT fixture will be updated.
  // If the ID specified does not already exist, or if the field is empty, then a new ICT fixture will be added with the specified properties.
  // The file format should be the same as the one produced from CCA -> Export ICT Fixtures.
  rpc updateICTFixturesByFile(UpdateICTFixturesByFileRequest) returns (UpdateICTFixturesResponse);

  // Update mount points with specified properties.
  rpc updateMountPoints(UpdateMountPointsRequest) returns (UpdateMountPointsResponse);

  // Update the mount points properties of a CCA from a CSV formatted file. This API could be used to add new mount points or update existing ones depending on the file contents.
  // If the ID specified already exists, then the properties for that mount point will be updated.
  // If the ID specified does not already exist, or if the field is empty, then a new mount point will be added with the specified properties.
  // The file format should be the same as the one produced from CCA -> Export Mount Points.
  rpc updateMountPointsByFile(UpdateMountPointsByFileRequest) returns (UpdateMountPointsResponse);
  
  // Update the test points properties of a CCA from a CSV formatted file. This API could be used to add new test points or update existing ones depending on the file contents.
  // If the ID specified already exists, then the properties for that test point will be updated.
  // If the ID specified does not already exist, or if the field is empty, then a new test point will be added with the specified properties.
  // The file format should be the same as the one produced from CCA -> Export Test Points.
  rpc updateTestPointsByFile(UpdateTestPointsByFileRequest) returns (UpdateTestPointsResponse);
}
