// © 2020 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 = "SherlockProjectServiceProto";


/**
  * Request for project report.
  */
message GenReportRequest {
  string project		= 1;	// Sherlock project name.
  string author			= 2;	// Name of the author who generates the report.
  string company		= 3;	// Name of author's company.
}

/**
  * Streams the project report in chunks.
  */
message GenReportResponse {
  bytes content			= 1;	// A chunk of the project report being returned in increments.
  int32 size			= 2;	// Size of the chunk returned.
  ReturnCode returnCode	= 3;	// Status code of response.
}

/**
  * Request for project CCA report.
  */
message GenCCAReportRequest {
  string project		= 1;	// Sherlock project name.
  string cca			= 2;	// Project CCA name.
  string author			= 3;	// Name of the author who generates the report.
  string company		= 4;	// Name of author's company.
}

/**
  * Streams the project CCA report in chunks.
  */
message GenCCAReportResponse {
  bytes content			= 1;	// A chunk of the project CCA report being returned in increments.
  int32 size			= 2;	// Size of the chunk returned.
  ReturnCode returnCode	= 3;	// Status code of response.
}

/**
  * Request for importing an ODB++ archive.
  */
message ImportODBRequest {
  string archiveFile			= 1;		// Full path to the ODB++ archive file to be imported.
  string project				= 2;		// Sherlock project name. If empty, the filename will be used for the project name.
  string ccaName				= 3;		// Project CCA name. If empty, the filename will be used for the CCA name.	
  bool processLayerThickness 	= 4;		// Option to assign stackup  thickness.		
  bool includeOtherLayers 		= 5;		// Option to include other layers.
  bool processCutoutFile 		= 6;		// Option to process cutouts.
  bool guessPartProperties		= 7;		// Option to guess part properties
  bool imsStackup				= 8;		// Option to generate IMS stackup.
}

/**
  * Request for importing an IPC-2581 archive.
  */
message ImportIPC2581Request {
  string archiveFile			= 1;		// Full path to the IPC-2581 archive file to be imported.
  string project				= 2;		// Sherlock project name. If empty, the filename will be used for the project name.
  string ccaName				= 3;		// Project CCA name. If empty, the filename will be used for the CCA name.	
  bool includeOtherLayers 		= 4;		// Option to include other layers.
  bool guessPartProperties		= 5;		// Option to guess part properties
}

/**
  * Request for deleting project
  */
message DeleteProjectRequest{
  string project = 1;	// Project name of project to be deleted
}

/**
  * Request to add a strain map CSV file
  */
message AddStrainMapRequest {
  string project					= 1;	// Sherlock project name.
  message StrainMapFile {
    string strainMapFile			= 1;	// Full path to the strain map file to be added.
    string fileComment				= 2;	// File comment text.
    int32  headerRowCount			= 3;	// Number of rows before the column header in the file.
	string referenceIDColumn		= 4;	// Reference ID column name.
	string strainColumn				= 5;	// Strain column name.
	string strainUnits				= 6;	// Strain units used in the strain map file. Valid units: µε, ε
    repeated string cca				= 7;	// Project CCA names to to add the file to.
  }
  repeated StrainMapFile strainMapFiles	= 2;	// Strain map files and associated properties to be added.
}

/**
  * Response from adding strain map CSV files
  */
message AddStrainMapResponse {
  ReturnCode returnCode		= 1;	// Status code of response.
  repeated string errors	= 2;	// List of validation errors.
}

/**
 * Request to list CCA strain maps for a project
 */
message ListStrainMapsRequest {
  string project		= 1;	// Sherlock project name.
  repeated string cca	= 2;	// Optional project CCA names to list strain maps for.
}

/**
  * Lists the strain maps assigned to the project CCA's.
  */
message ListStrainMapsResponse {
  ReturnCode returnCode			= 1;	// Status code of response.
  repeated string errors		= 2;	// List of errors encountered.
  message CcaStrainMap {
    string ccaName				= 1;	// Name of the CCA.
    repeated string strainMaps	= 2;	// Strain map names assigned to the CCA.
  }
  repeated CcaStrainMap ccaStrainMaps	= 3;	// CCA strain maps assigned to the project.
}

/**
 * Request to list CCA's and sub-assembly CCA's for a project
 */
message ListCCAsRequest {
  string project		= 1;	// Sherlock project name.
  repeated string cca	= 2;	// Optional project CCA names to return.
}

/**
  * Represents the circuit cards, their properties, and sub-assemblies for a Sherlock project.
  */
message ListCCAsResponse {
  ReturnCode returnCode			= 1;	// Status code of response.
  message CCA {
    string ccaName				= 1;	// Name of the CCA.
    repeated CCA subAssemblies	= 2;	// Sub-assemblies assigned to the CCA.
  }
  repeated CCA ccas				= 2;	// CCA's assigned to the project.
}

service SherlockProjectService {
  // Generates the project report and return it via streaming.
  rpc genReport(GenReportRequest) returns (stream GenReportResponse);

  // Generates the project CCA report and return it via streaming.
  rpc genCCAReport(GenCCAReportRequest) returns (stream GenCCAReportResponse);
  
  // Imports an ODB++ archive.
  rpc importODBArchive(ImportODBRequest) returns (ReturnCode);
  
  // Imports an ODB++ archive.
  rpc importIPC2581Archive(ImportIPC2581Request) returns (ReturnCode);
  
  // Delete a project from Sherlock
  rpc deleteProject(DeleteProjectRequest) returns (ReturnCode);
  
  // Add a strain map to a Sherlock project
  rpc addStrainMap(AddStrainMapRequest) returns (AddStrainMapResponse);
  
   // Returns a list of circuit cards and their assigned strain maps for a given Sherlock project.
  rpc listStrainMaps(ListStrainMapsRequest) returns (ListStrainMapsResponse);

   // Returns a list of circuit cards, their properties, and sub-assemblies for a given Sherlock project.
  rpc listCCAs(ListCCAsRequest) returns (ListCCAsResponse);
}
