﻿// NOTICE: SEMI makes no warranties or representations as to the suitability of 
// the standards set forth herein for any particular application. The 
// determination of the suitability of the standard is solely the responsibility 
// of the user. Users are cautioned to refer to manufacturer's instructions, 
// product labels, product data sheets, and other relevant literature, 
// respecting any materials or equipment mentioned herein. These standards 
// are subject to change without notice.
// 
// By publication of this standard, Semiconductor Equipment and Materials 
// International (SEMI) takes no position respecting the validity of any patent 
// rights or copyrights asserted in connection with any items mentioned in this 
// standard. Users of this standard are expressly advised that determination of 
// any such patent rights or copyrights, and the risk of infringement of such 
// rights are entirely their own responsibility.

syntax = "proto3";

import "SEMIE179-0822.proto";
import "SEMIE132-02-0422.proto";
import "google/protobuf/descriptor.proto";
import "google/protobuf/timestamp.proto";

package Semi;

// This proto file will define representations of objects in SEMI E125 in the Protocol Buffer 3 language

// ***************************************************************
// Version information
// ***************************************************************

// Protobuf3 doesn't support the concept of constants
// We want a way for the implementor to get the .proto file version
// if they want to log or check this information.
// We workaround the issue by exposing a file attribute with the version information
// Information corresponding to the associated SEMI Standard as a custom file option on the .proto file.
//
// Note - the ProtoBufFileVersion will uniquely identify the .proto file version.
// * For the .proto file associated with the official standard, the ProtoBufFileVersion will
//   be the SEMI Standard version (including the publication date in MMYY format)
//   For example, 
//     ProtoBufFileVersion="E134.2-MMYY" will indicate this .proto file is for
//	   an official SEMI Version (SEMI E134.2-MMYY)
// * If the .proto file is for an interim release (for example as part of a ballot),  
//   suffix information along the lines of "-Ballot<nnnn>-<Date>" can be added.
//   For example,
//     ProtoBufFileVersion="E134.2-Ballot1234-20180522" will indicate this .proto file is an iterim version for
//     SEMI E134.2-XXXX Ballot 1234 and was released on May 22, 2018
//
// Note - SemiStandardInforamtion Field is defined once in SEMIZZZ-xxxx.proto

option (SemiStandardInformation) = 
{
	SemiStandard : "SEMI E125.2",
	ProtoBufFileVersion : "SEMIE125-02-1022"
};

// ***************************************************************
// Enumerated Type Definitions
// ***************************************************************

// Best Practice is to specify Unknown element as index 0 for future proofing
// Enum elements need to be unique across the namespace, so make sure Unknown element name
// is meaningful to the enum.

// Specifies the parameter's transient nature
enum ParameterTransientNature
{
	UnknownParameterTransientNature = 0;
	Transient = 1;				// Transient parameters are reportable only in association with certain
								// events and exceptions 
	Restricted = 2;				// Restricted parameters are available to report data at any times in 
								// certain conditions
	Unrestricted = 3;			// Unrestricted parameter are avaialble to report data at any time the 
								// equipment communication is available

	reserved 4 to 999;	// Reserved for future use
}

// Sepcifies the valid type of SECS variables
enum SecsVariableTypeSpecifier
{
	UnknownSecsVariableTypeSpecifier = 0;
	StatusVariable = 1;					// Status Variable (SV)
	EquipmentConstantVariable = 2;		// Equipment Constant Variable (ECV)
	DataVariable = 3;					// Data Variable (DV)

	reserved 4 to 999;	// Reserved for future use
}

// Specifies the valid exeception severity levels
enum ExceptionSeveritySpecifier
{
	UnknownExceptionSeveritySpecifier = 0;
	Fatal = 1;				// Fatal exception severity
	Error = 2;				// Error exception severity
	Warning = 3;			// Warning exception severity
	Informational = 4;		// Informational exception severity

	reserved 5 to 999;	// Reserved for future use
}

// ***************************************************************
// Message Definitions
// ***************************************************************

// Protobuf message names need to be unique.  There is already a message ParaemterReferenceType defined 
// in the .proto file corresponding for SEMI E134.
// Use EquipmentParameterReferenceType as the message name for SEMI E125 ParameterReference 
message EquipmentParameterReferenceType
{
	string ParameterName = 1;
	string ParameterID = 2;
}

message StateMachineInstanceEventType	 
{
	string EventId = 1;		// Identifier for the StateMachine Event for which Parameters 
							// might be available.
							
	string EventName = 2;	// Name of the StateMachine Event
	sint64 SecsCeid = 3;	// Use sint64 data type because largest CEID per SEMI E5 is 
							// 8 byte integer (signed).  

	repeated EquipmentParameterReferenceType AvailableParameter = 4;	
}

message StateMachineInstanceType	
{
	string StateMachineId = 1;									
	string StateMachineName = 2;
	EquipmentParameterReferenceType CurrentState = 3;		
	EquipmentParameterReferenceType PreviousState = 4;		
	repeated StateMachineInstanceEventType StateMachineInstanceEvent = 5;	
																			
	repeated StateMachineInstanceType NestedStateMachine = 6;	
}

// INTERNAL -<xsd:complexType name="UnitConfigArrayType">
// INTERNAL -<xsd:sequence>
// INTERNAL -	<xsd:element name="UnitConfig" type="UnitConfigType" nillable="false" maxOccurs="unbounded"/>
// INTERNAL -</xsd:sequence>
// INTERNAL -<xsd:attribute name="configParamSource" type="cem:LocatorType" use="required"/>
// INTERNAL -<xsd:attribute name="configParamName" type="xsd:string" use="required"/>
// INTERNAL -</xsd:complexType>
// INTERNAL -<xsd:complexType name="UnitConfigType" final="#all">
// INTERNAL -<xsd:attribute name="unitSymbol" type="xsd:string" use="required"/>
// INTERNAL -<xsd:attribute name="setting" type="xsd:string" use="required"/>
// INTERNAL -</xsd:complexType>

message ParameterClassificationType 
{
	ParameterTransientNature IsTransient = 1;	
	string Descrption = 2;
}

message ConstraintType		
{
	string Name = 1;		
	string Descrption = 2;	
	string Definition = 3;	
}

message SECSVarRefType 
{
	sint64 SecsVId = 1;							// Use sint64 data type because largest VID per SEMI E5 is 
												// 8 byte integer (signed).  

	SecsVariableTypeSpecifier SecsVarClass = 2;	// Use enumerated value - calling code can map to text string
												
}

message CachedDataPropertiesType
{
	double minCollectionInterval = 1;	// Positive real number 
	double maxCollectionInterval = 2;	// Positive real number
	sint32 minReportingInterval	= 3;	// Positive Integer
	sint32 maxReportingInterval	= 4;	// Positive Integer
}

message ParameterType 	
{
	string ParameterId = 1;			
	string TypeName = 2;			
	string Description = 3;		
	repeated ConstraintType Constraint = 4;					
	oneof Classification
	{
		ParameterClassificationType Control = 5;		
		ParameterClassificationType Configuration = 6;	
		ParameterClassificationType Data = 7;			
	}
	ParameterUnitType Unit = 8;
	repeated SECSVarRefType SECSVariable = 9;					
	repeated CachedDataPropertiesType CachedDataProperties = 10;

}

message ParameterUnitType
{

	oneof ParameterUnit
	{
		string UnitId = 1;
		UnitConfigType AvailableUnit= 2;
	}  
}

message UnitConfigType
{
	repeated string UnitId = 1;
	EquipmentParameterReferenceType UnitSymbolParameter = 2;
}

message TransitionType	
{
	
	string TransitionName = 1;	// Human-readable name for this transition
								
	string TransitionId = 2;	// Unique identifier for this transition
								
	string Description = 3;		
	string SourceStateId = 4;	// State of origin for this transaction
								
	string TargetStateId = 5;	// Transitioned-to state
								
}

message StateMachineEventType	
{
	string EventId = 1;					
	string Description = 2;				
	repeated string TransitionId = 3;	

}

message StateType 	
{
	string StateName = 1;	// Human-readable name for this state
							
	string StateId = 2;		// Unique identifier for this state
							
	string Description = 3;	
	oneof State				
	{
		StatesType SubState = 4;	
		StateMachinesType StateMachine = 5;	
	}
}

// Container object of repeated StateType objects

message StatesType
{
	repeated StateType State = 1;
}

message StateMachineType	
{
	string StateMachineId = 1;				
	string Description = 2;					
	StateType Top = 3;						// Top level state for this state machine
											
	repeated TransitionType Transition = 4;	
	repeated StateMachineEventType Event = 5;	

}

// Container object of repeated StateMachineType objects

message StateMachinesType
{
	repeated StateMachineType StateMachine = 1;
}

message StateMachineReferenceType
{
	string stateMachineID = 1;

	oneof StateMachineInstance	
	{
		EquipmentParameterReferenceType StateMachineInstanceParameter = 2;
	}
	repeated StateMachineReferenceEventType StateMachineReferenceEvent = 3;
	repeated StateMachineReferenceType NestedStateMachine = 4;
}

message StateMachineReferenceEventType
{
	string EventID = 1;
	string EventName = 2;
	repeated sint64 SecsCeids = 3;	// Use sint64 data type because largest CEID per SEMI E5 is 
									// 8 byte integer (signed).  
									
	repeated EquipmentParameterReferenceType AvailableParameter = 4;
}

message SimpleEventType		
{
	string EventId = 1;		
	string Description = 2;	

}

message SimpleEventInstanceType
{
	string EventName = 1;
	string EventID = 2;
	sint64 SecsCeid = 3;					// Use sint64 data type because largest CEID per SEMI E5 is 
											// 8 byte integer (signed).  
											
	repeated EquipmentParameterReferenceType AvailableParameter = 4;

}

message SEMIObjType	
{
	string StandardVersion = 1;	

	string ObjType = 2;			
	repeated AttributeType Attribute = 3;		

}

message AttributeType
{
	string AttributeID = 1;
	string TypeName = 2;
	EquipmentParameterReferenceType AssociatedParameter = 3;
	string Description = 4;
	ParameterUnitType Unit = 5;
}

message SEMIObjTypeReferenceType 	
{
	string ObjType = 1;				// Maps to type attribute (identifier for unique SEMOObjTypeReference
									
}

message ExceptionType	
{
	string ExceptionId = 1;						
	string Description = 2;						
	ExceptionSeveritySpecifier Severity = 3;	

}

message ExceptionInstanceType
{
	string ExceptionName = 1;
	string ExceptionID = 2;
	sint64 SecsAlid = 3;					// Use sint64 data type because largest ALID per SEMI E5 is 
											// 8 byte integer (signed).  
											
	sint64 SecsSetCeid = 4;					// Use sint64 data type because largest CEID per SEMI E5 is 
											// 8 byte integer (signed).  
											
	sint64 SecsClearCeid = 5;				// Use sint64 data type because largest CEID per SEMI E5 is 
											// 8 byte integer (signed).  
											
	repeated EquipmentParameterReferenceType ExceptionParameter = 6;
}

message EquipmentNodeDescriptionType	
{
	string EquipmentNodeId = 1;	// Corresponds to the 'node' object in SEMI E125's EquipmentNodeDescription class
								// Element of a type derived from the SEMI E120 Nameable class

	repeated StateMachineReferenceType StateMachineReference = 2;
	repeated StateMachineInstanceType StateMachineInstance = 3;	
	repeated SEMIObjTypeReferenceType SemiObjTypeReference = 4;

	repeated ExceptionInstanceType ExceptionInstance = 5;	

	repeated EquipmentParameterReferenceType ParameterReference = 6;	

	repeated SimpleEventInstanceType SimpleEventInstance = 7;	
	// INTERNAL -	

}

// Currently no information to be passed in this message
message GetUnitsRequestType	
{
}

message GetUnitsResponseType 	
{
	
	repeated UnitType Unit = 1;		

	oneof ErrorInformation						
	{
		ErrorType Error = 2;    									// Use this for regular errors that use ErrorType content 
																	// for example UnrecognizedSession
																	
	}
}

// Currently no information to be passed in this message
message GetTypeDefinitionsRequestType	
{
}

message GetTypeDefinitionsResponseType 	
{
	repeated TypeDefinitionType TypeDefinition = 1;	

	oneof ErrorInformation						
	{
		ErrorType Error = 2;    									// Use this for regular errors that use ErrorType content 
																	// for example UnrecognizedSession
																	
	}
}

// Currently no information to be passed in this message
message GetStateMachinesRequestType	
{	
}

message GetStateMachinesResponseType	
{
	repeated StateMachineType StateMachine = 1;	

	// INTERNAL -

	oneof ErrorInformation						
	{
		ErrorType Error = 2;    									// Use this for regular errors that use ErrorType content 
																	// for example UnrecognizedSession
																	
	}
}

// Currently no information to be passed in this message
message GetSEMIObjTypesRequestType	
{	
}

message GetSEMIObjTypesResponseType		
{
	repeated SEMIObjType ObjType = 1;	

	// INTERNAL -

	oneof ErrorInformation						
	{
		ErrorType Error = 2;    									// Use this for regular errors that use ErrorType content 
																	// for example UnrecognizedSession
																	
	}
}

// Currently no information to be passed in this message
message GetExceptionsRequestType	
{
}

message GetExceptionsResponseType	
{
	repeated ExceptionType Exception = 1;
	// INTERNAL -

	oneof ErrorInformation						
	{
		ErrorType Error = 2;    									// Use this for regular errors that use ErrorType content 
																	// for example UnrecognizedSession
																	
	}
}

// Currently no information to be passed in this message
message GetParametersRequestType	
{
}

message GetParametersResponseType	
{
	repeated ParameterType Parameter= 1;	// Unordered list of Parameters
	// INTERNAL -

	oneof ErrorInformation						
	{
		ErrorType Error = 2;    									// Use this for regular errors that use ErrorType content 
																	// for example UnrecognizedSession
																	
	}
}

// Currently no information to be passed in this message
message GetSimpleEventsRequestType	
{
}

message GetSimpleEventsResponseType	
{
	repeated SimpleEventType SimpleEvent = 1;	// Unordered list of SimpleEvent
	// INTERNAL -

	oneof ErrorInformation						
	{
		ErrorType Error = 2;    									// Use this for regular errors that use ErrorType content 
																	// for example UnrecognizedSession
																	
	}
}

// Currently no information to be passed in this message
message GetEquipmentStructureRequestType 
{
}

message GetEquipmentStructureResponseType	
{
	string EquipmentStructure = 1;		

	// INTERNAL -

	oneof ErrorInformation						
	{
		ErrorType Error = 2;    									// Use this for regular errors that use ErrorType content 
																	// for example UnrecognizedSession
																	
	}
}

message GetEquipmentNodeDescriptionsRequestType	// INTERNAL -<xsd:complexType name="GetEquipmentNodeDescriptionsRequestType" final="#all">
{
	repeated string EquipmentNodeId = 1;	

	uint32 filter = 2;						 											
}

message NodeDescriptionResultType	
{
	repeated EquipmentNodeDescriptionType NodeDescription = 1;	

	repeated string UnrecongizedId = 2;							

}

message GetEquipmentNodeDescriptionsResponseType	 // INTERNAL -<xsd:complexType name="GetEquipmentNodeDescriptionsResponseType" final="#all">
{ 
	NodeDescriptionResultType EquipmentNodeDescription = 1;	
	// INTERNAL -

	oneof ErrorInformation						
	{
		ErrorType Error = 2;    									// Use this for regular errors that use ErrorType content 
																	// for example UnrecognizedSession
																	
	}
}

// Currently no information to be passed in this message
message GetLatestRevisionRequestType 	
{
}

message GetLatestRevisionResponseType 	
{
	string Revision = 1;	
							
	// INTERNAL -

	oneof ErrorInformation						
	{
		ErrorType Error = 2;    									// Use this for regular errors that use ErrorType content 
																	// for example UnrecognizedSession
																	
	}
}

message NotifyOnRevisionsRequestType	
{
	bool Enable = 1;	
}

message NotifyOnRevisionsResponseType	
{

	oneof Error         
						
	{
		ErrorType ErrorInformation = 1;       
	}
}

message MetadataRevisedNotificationType	
{
	string Revision = 1;	
							
}

// Container message for all the items that could be sent on the stream to the server related to Equipment Metadata 
// Note - Define the message as empty to accommodate future changes
// (if adding input parameters, don't need to change the method interface)
message EquipmentMetadataNotificationUsageStreamRequest
{

	// oneof Request
	// {
	// 	// Add message definition
    // }

}

// Container message for all the items that could be sent on the stream from the server
// related to equipment metadata (unprompted information from the Server)
message EquipmentMetadataNotificationUsageStreamResponse
{
	oneof Result
	{
		MetadataRevisedNotificationType MetadataRevisedNotification = 1;	
	}

}

// Container message for all the items that could be sent on the stream from the server related to Status Data
message ConsumerEquipmentMetadataNotificationUsageStreamRequest
{
	oneof Request
	{
		MetadataRevisedNotificationType MetadataRevisedNotification = 1;	
	}
}

// Container message for all the items that could be sent on the stream to the server
// Note - Define the message as empty to accommodate future changes
// (if adding input parameters, don't need to change the method interface)
message ConsumerEquipmentMetadataNotificationUsageStreamResponse
{

	// oneof Result
	// {
	// 	// Add message definition
    // }
}

// ***************************************************************
// Service Definitions
// ***************************************************************

// The E125EquipmentMetadataManagement looks after data management functionality for the EDA Client Session
service E125EquipmentMetadataManagement
{
	// *********************************************************************
	// Unary Request/Response methods to manage equipment metadata
	// *********************************************************************

	rpc GetUnits (GetUnitsRequestType) returns (GetUnitsResponseType){};			

	rpc GetTypeDefinitions (GetTypeDefinitionsRequestType) returns (GetTypeDefinitionsResponseType){};			

	rpc GetStateMachines (GetStateMachinesRequestType) returns (GetStateMachinesResponseType){};

	// <!-- Web Services -->

	rpc GetSEMIObjTypes (GetSEMIObjTypesRequestType) returns (GetSEMIObjTypesResponseType){};			

	rpc GetExceptions (GetExceptionsRequestType) returns (GetExceptionsResponseType){};			

	rpc GetParameters (GetParametersRequestType) returns (GetParametersResponseType){};			

	rpc GetSimpleEvents (GetSimpleEventsRequestType) returns (GetSimpleEventsResponseType){};			

	rpc GetEquipmentStructure (GetEquipmentStructureRequestType) returns (GetEquipmentStructureResponseType){};			

	rpc GetEquipmentNodeDescriptions (GetEquipmentNodeDescriptionsRequestType) returns (GetEquipmentNodeDescriptionsResponseType){};			

	rpc GetLatestRevision (GetLatestRevisionRequestType) returns (GetLatestRevisionResponseType){};			

	rpc NotifyOnRevisions (NotifyOnRevisionsRequestType) returns (NotifyOnRevisionsResponseType){};			

	// *********************************************************************
	// Streaming  methods 
	// *********************************************************************

	// Streams to handle notification message events from the Equipment Server

	rpc EquipmentMetadataNotificationUsageStream (stream EquipmentMetadataNotificationUsageStreamRequest) returns (stream EquipmentMetadataNotificationUsageStreamResponse) {}
}

// This service looks after Operational messages and notification functionality when
// the Equipment Server initiates the connection
// It is in a separate service from Metadata Management to support scenarios
// the EDA Application only has Consumer Sessions. 
service E125ConsumerReceiverEquipmentMetadata
{
	// *********************************************************************
	// Unary Request/Response methods related to data collection
	// *********************************************************************
	// None

	// *********************************************************************
	// Streaming  methods 
	// *********************************************************************

	// Streams to handle 'unprompted' message events from the EDA Server
	// Separate RPC method because not all Consumer Sessions are interested in these messages

	// Note - there is no streaming gRPC method in this service for operational messages
	// from the Equipment Server since SEMI E125 does not support operational messages.

	// Streaming gRPC method to handle notification messages

	rpc ConsumerEquipmentMetadataNotificationUsageStream (stream ConsumerEquipmentMetadataNotificationUsageStreamRequest) returns (stream ConsumerEquipmentMetadataNotificationUsageStreamResponse) {}
}

