from .StoredProcedureOperation import StoredProcedureOperation
from ..Guid import Guid
from ..SQLParameter import SQLParameter
from ..SQLFunctionCall import SQLFunctionCall

class PrepareInstanceOperation(StoredProcedureOperation):

	def __init__(self, classGlobalIdentifier : Guid, globalIdentifier : Guid, classIndex : int, instanceIndex : int):
		self.classGlobalIdentifier = classGlobalIdentifier
		self.globalIdentifier = globalIdentifier
		self.classIndex = classIndex
		self.instanceIndex = instanceIndex

	def get_sp_name(self):
		return "mocha_prepare_instance"

	def get_sp_parameters(self):
		parms = []
		
		globalId = None
		if self.globalIdentifier is not None:
			globalId = self.globalIdentifier

		classGlobalId = None
		if self.classGlobalIdentifier is not None:
			classGlobalId = self.classGlobalIdentifier

		strCid = None
		if self.classIndex is not None:
			strCid = self.classIndex
			
		strIid = None
		if self.instanceIndex is not None:
			strIid = self.instanceIndex

		return [strCid, strIid, classGlobalId, globalId, None, None, SQLParameter("p_assigned_inst_id")]
