/*******************************************************************************
 *  Copyright 2017-2018 Centre for Development of Advanced Computing(C-DAC), Pune
 *  
 * Licensed under the Apache License, Version 2.0 (the "License");
 * you may not use this file except in compliance with the License.
 * You may obtain a copy of the License at
 *  
 *   http://www.apache.org/licenses/LICENSE-2.0
 *  
 * Unless required by applicable law or agreed to in writing, software
 * distributed under the License is distributed on an "AS IS" BASIS,
 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
 * See the License for the specific language governing permissions and
 * limitations under the License.
 *******************************************************************************/
package cdac.medinfo.sdk.dcm30_04.dicommodel.modules;


import cdac.medinfo.sdk.dcm30_04.baselibs.ActualHumanPerformersSequence;
import cdac.medinfo.sdk.dcm30_04.baselibs.DicomV3Factory;
import cdac.medinfo.sdk.dcm30_04.baselibs.PerformedProcessingApplicationsCodeSequence;
import cdac.medinfo.sdk.dcm30_04.baselibs.PerformedStationClassCodeSequence;
import cdac.medinfo.sdk.dcm30_04.baselibs.PerformedStationGeographicLocationCodeSequence;
import cdac.medinfo.sdk.dcm30_04.baselibs.PerformedStationNameCodeSequence;
import cdac.medinfo.sdk.dcm30_04.baselibs.PerformedWorkitemCodeSequence;
import cdac.medinfo.sdk.dcm30_04.baselibs.Tag;
import cdac.medinfo.sdk.dcm30_04.commoninterface.IDataSet;
import cdac.medinfo.sdk.dcm30_04.commoninterface.ITag;
import cdac.medinfo.sdk.dcm30_04.enums.EnumGeneralPurposePerformedProcedureStepStatus;
import cdac.medinfo.sdk.dcm30_04.exceptions.InvalidModuleException;
import cdac.medinfo.sdk.dcm30_04.utils.DicomConstants;
import cdac.medinfo.sdk.dcm30_04.utils.ISingleCollection;
import cdac.medinfo.sdk.dcm30_04.utils.SingleCollection;

// TODO: Auto-generated Javadoc
/**
 \* This module specifies attributes of General Purpose Performed Procedure Step Information Module.
 */
public class GeneralPurposePerformedProcedureStepInformationModule extends Module  
{

 
 /**
  * The obj single collection.
  */
 public static ISingleCollection<ITag> objSingleCollection = null;
	

	/**
	 * Instantiates a new general purpose performed procedure step information module.
	 * 
	 * @param objIDataSet the obj i data set
	 */
	public GeneralPurposePerformedProcedureStepInformationModule(IDataSet objIDataSet)
	{
		super(objIDataSet);
	}

	static
	{
		objSingleCollection = new SingleCollection<ITag>();
		objSingleCollection.add(new Tag(0x0040,0x4035));
		objSingleCollection.add(new Tag(0x0040,0x4028));
		objSingleCollection.add(new Tag(0x0040,0x4029));
		objSingleCollection.add(new Tag(0x0040,0x4030));
		objSingleCollection.add(new Tag(0x0040,0x4007));
		objSingleCollection.add(new Tag(0x0040,0x0244));
		objSingleCollection.add(new Tag(0x0040,0x0245));
		objSingleCollection.add(new Tag(0x0040,0x0253));
		objSingleCollection.add(new Tag(0x0040,0x0250));
		objSingleCollection.add(new Tag(0x0040,0x0251));
		objSingleCollection.add(new Tag(0x0040,0x4002));
		objSingleCollection.add(new Tag(0x0040,0x0254));
		objSingleCollection.add(new Tag(0x0040,0x0280));
		objSingleCollection.add(new Tag(0x0040,0x4019));
	}

	/**
	 * This method validates each Attribute in the Module according to the Type
	 * of the Attribute.Attributes are of 5 types.
	 * Type 1,Type 2 are Mandatory:
	 * Mandatory Attributes have to present in the Module.
	 * Type 1C,2C are Conditional:
	 * Conditional Attributes' presence depend on a condition.
	 * If the condition is satisfied the Attribute has to be present.
	 * Type 3 are Optional
	 * Optional Attributes can be added as and when required.
	 * 
	 * @return boolean - returns validation status as success or failure
	 * 
	 * @throws InvalidModuleException - If validation of Module fails
	 */
	public boolean validateModule() throws InvalidModuleException
	{
		return true;
	}

	/**
	 * This method returns the vector of keys representing the DataElements
	 * that belong to this module.
	 * 
	 * @return vector of Tags - returns the vector containing the collection of tags.
	 */
	public ISingleCollection<ITag> getVectorOfKeys()
	{
		return objSingleCollection;
	}

	/**
	 * Retrieves pre-initialized object of ActualHumanPerformersSequence.If the module contains the sequence object
	 * it returns the same otherwise it creates the sequence adds to the module with proper initialization
	 * and then returns the object of sequence
	 * 
	 * @return ActualHumanPerformersSequence - instance of Actual Human Performers Sequence.
	 */
	public ActualHumanPerformersSequence getActualHumanPerformersSequence()
	{
		ActualHumanPerformersSequence objActualHumanPerformersSequence = (ActualHumanPerformersSequence)getDicomValue(0x0040,0x4035);
		if(objActualHumanPerformersSequence == null)
		{
			/*
			 * If the sequence object is not present in the DataSet, a new sequence object is created and
			 * the TransferSyntax and DictionaryReader is set into it as it is set in the Module. This ensures that 
			 * the DataElements getting added in the DataSet follow the same TransferSyntax and use the same
			 * DictionaryReader object as that of the module.
			 */
			DicomV3Factory objDicomV3Factory = DicomV3Factory.createInstance();
			objActualHumanPerformersSequence = (ActualHumanPerformersSequence)objDicomV3Factory.createSequence(0x0040,0x4035, objITransferSyntax, objIDictionaryReader);
			
			// This will add Data Element of SQ to the DataSet.
			addDataElement(0x0040,0x4035, DicomConstants.DCM_DT_SQ, objActualHumanPerformersSequence.getValue());
		}
		return objActualHumanPerformersSequence;
	}

	/**
	 * Retrieves pre-initialized object of PerformedStationNameCodeSequence.If the module contains the sequence object
	 * it returns the same otherwise it creates the sequence adds to the module with proper initialization
	 * and then returns the object of sequence
	 * 
	 * @return PerformedStationNameCodeSequence - instance of Performed Station Name Code Sequence
	 */
	public PerformedStationNameCodeSequence getPerformedStationNameCodeSequence()
	{
		PerformedStationNameCodeSequence objPerformedStationNameCodeSequence = (PerformedStationNameCodeSequence)getDicomValue(0x0040,0x4028);
		if(objPerformedStationNameCodeSequence == null)
		{
			/*
			 * If the sequence object is not present in the DataSet, a new sequence object is created and
			 * the TransferSyntax and DictionaryReader is set into it as it is set in the Module. This ensures that 
			 * the DataElements getting added in the DataSet follow the same TransferSyntax and use the same
			 * DictionaryReader object as that of the module.
			 */
			DicomV3Factory objDicomV3Factory = DicomV3Factory.createInstance();
			objPerformedStationNameCodeSequence = (PerformedStationNameCodeSequence)objDicomV3Factory.createSequence(0x0040,0x4028, objITransferSyntax, objIDictionaryReader);
			
			// This will add Data Element of SQ to the DataSet.
			addDataElement(0x0040,0x4028, DicomConstants.DCM_DT_SQ, objPerformedStationNameCodeSequence.getValue());
		}
		return objPerformedStationNameCodeSequence;
	}

	/**
	 * Retrieves pre-initialized object of PerformedStationClassCodeSequence.If the module contains the sequence object
	 * it returns the same otherwise it creates the sequence adds to the module with proper initialization
	 * and then returns the object of sequence
	 * 
	 * @return PerformedStationClassCodeSequence - instance of Performed Station Class Code Sequence
	 */
	public PerformedStationClassCodeSequence getPerformedStationClassCodeSequence()
	{
		PerformedStationClassCodeSequence objPerformedStationClassCodeSequence = (PerformedStationClassCodeSequence)getDicomValue(0x0040,0x4029);
		if(objPerformedStationClassCodeSequence == null)
		{
			/*
			 * If the sequence object is not present in the DataSet, a new sequence object is created and
			 * the TransferSyntax and DictionaryReader is set into it as it is set in the Module. This ensures that 
			 * the DataElements getting added in the DataSet follow the same TransferSyntax and use the same
			 * DictionaryReader object as that of the module.
			 */
			DicomV3Factory objDicomV3Factory = DicomV3Factory.createInstance();
			objPerformedStationClassCodeSequence = (PerformedStationClassCodeSequence)objDicomV3Factory.createSequence(0x0040,0x4029, objITransferSyntax, objIDictionaryReader);
			
			// This will add Data Element of SQ to the DataSet.
			addDataElement(0x0040,0x4029, DicomConstants.DCM_DT_SQ, objPerformedStationClassCodeSequence.getValue());
		}
		return objPerformedStationClassCodeSequence;
	}


	/**
	 * Retrieves pre-initialized object of PerformedStationGeographicLocationCodeSequence.If the module contains the sequence object
	 * it returns the same otherwise it creates the sequence adds to the module with proper initialization
	 * and then returns the object of sequence
	 * 
	 * @return PerformedStationGeographicLocationCodeSequence - instance of PerformedStation Geographic Location Code Sequence
	 */
	public PerformedStationGeographicLocationCodeSequence getPerformedStationGeographicLocationCodeSequence()
	{
		PerformedStationGeographicLocationCodeSequence objPerformedStationGeographicLocationCodeSequence = (PerformedStationGeographicLocationCodeSequence)getDicomValue(0x0040,0x4030);
		if(objPerformedStationGeographicLocationCodeSequence == null)
		{
			/*
			 * If the sequence object is not present in the DataSet, a new sequence object is created and
			 * the TransferSyntax and DictionaryReader is set into it as it is set in the Module. This ensures that 
			 * the DataElements getting added in the DataSet follow the same TransferSyntax and use the same
			 * DictionaryReader object as that of the module.
			 */
			DicomV3Factory objDicomV3Factory = DicomV3Factory.createInstance();
			objPerformedStationGeographicLocationCodeSequence = (PerformedStationGeographicLocationCodeSequence)objDicomV3Factory.createSequence(0x0040,0x4030, objITransferSyntax, objIDictionaryReader);
			
			// This will add Data Element of SQ to the DataSet.
			addDataElement(0x0040,0x4030, DicomConstants.DCM_DT_SQ, objPerformedStationGeographicLocationCodeSequence.getValue());
		}
		return objPerformedStationGeographicLocationCodeSequence;
	}

	/**
	 * Retrieves pre-initialized object of PerformedProcessingApplicationsCodeSequence.If the module contains the sequence object
	 * it returns the same otherwise it creates the sequence adds to the module with proper initialization
	 * and then returns the object of sequence
	 * 
	 * @return PerformedProcessingApplicationsCodeSequence - instance of Performed Processing Applications Code Sequence.
	 */
	public PerformedProcessingApplicationsCodeSequence getPerformedProcessingApplicationsCodeSequence()
	{
		PerformedProcessingApplicationsCodeSequence objPerformedProcessingApplicationsCodeSequence = (PerformedProcessingApplicationsCodeSequence)getDicomValue(0x0040,0x4007);
		if(objPerformedProcessingApplicationsCodeSequence == null)
		{
			/*
			 * If the sequence object is not present in the DataSet, a new sequence object is created and
			 * the TransferSyntax and DictionaryReader is set into it as it is set in the Module. This ensures that 
			 * the DataElements getting added in the DataSet follow the same TransferSyntax and use the same
			 * DictionaryReader object as that of the module.
			 */
			DicomV3Factory objDicomV3Factory = DicomV3Factory.createInstance();
			objPerformedProcessingApplicationsCodeSequence = (PerformedProcessingApplicationsCodeSequence)objDicomV3Factory.createSequence(0x0040,0x4007, objITransferSyntax, objIDictionaryReader);
			
			// This will add Data Element of SQ to the DataSet.
			addDataElement(0x0040,0x4007, DicomConstants.DCM_DT_SQ, objPerformedProcessingApplicationsCodeSequence.getValue());
		}
		return objPerformedProcessingApplicationsCodeSequence;
	}



	/**
	 * Sets attribute identifies Date on which the General Purpose Performed Procedure Step started.
	 * 
	 * @param StrPerformedProcedureStepStartDate - String Date on which the General Purpose Performed Procedure Step started.
	 */	
	public void setPerformedProcedureStepStartDate(String StrPerformedProcedureStepStartDate)
	{
		/*Accept Image identification characteristics in String Array format of type CS.
		 * Read the Transfer Syntax and check to create ImplicitDE or ExplicitDE .
		 * Set the iGroupNumber and iElementNumber to ImplicitDE object 
		 * Set the iVRType
		 * Set length from the element
		 * Add this element to the Hash Map
		 */
		addDataElement(0x0040,0x0244, DicomConstants.DCM_DT_DA, StrPerformedProcedureStepStartDate);
	}

	/**
	 * Return attribute identifies Date on which the General Purpose Performed Procedure Step started.
	 * 
	 * @return String - String Date on which the General Purpose Performed Procedure Step started.
	 */
	public String getPerformedProcedureStepStartDate()
	{
		Object objValue = getValue(0x0040,0x0244);
		if(objValue != null)
			return objValue.toString();
		return null;
	}



	/**
	 * Sets attribute identifies Time at which the General Purpose Performed Procedure Step started.
	 * 
	 * @param strPerformedProcedureStepStartTime - String Time at which the General Purpose Performed Procedure Step started.
	 */	
	public void setPerformedProcedureStepStartTime(String strPerformedProcedureStepStartTime)
	{
		/*Accept Image identification characteristics in String Array format of type CS.
		 * Read the Transfer Syntax and check to create ImplicitDE or ExplicitDE .
		 * Set the iGroupNumber and iElementNumber to ImplicitDE object 
		 * Set the iVRType
		 * Set length from the element
		 * Add this element to the Hash Map
		 */
		addDataElement(0x0040,0x0245, DicomConstants.DCM_DT_TM, strPerformedProcedureStepStartTime);
	}

	/**
	 * Return attribute identifies Time at which the General Purpose Performed Procedure Step started.
	 * 
	 * @return String - String Time at which the General Purpose Performed Procedure Step started.
	 */
	public String getPerformedProcedureStepStartTime()
	{
		Object objValue = getValue(0x0040,0x0245);
		if(objValue != null)
			return objValue.toString();
		return null;
	}



	/**
	 * Sets attribute identifies User or equipment generated identifier of that part of
	 * a Procedure that has been carried out within this procedure step.
	 * 
	 * @param StrPerformedProcedureStepID - String User or equipment generated identifier.
	 */	
	public void setPerformedProcedureStepID(String StrPerformedProcedureStepID)
	{
		/*Accept Image identification characteristics in String Array format of type CS.
		 * Read the Transfer Syntax and check to create ImplicitDE or ExplicitDE .
		 * Set the iGroupNumber and iElementNumber to ImplicitDE object 
		 * Set the iVRType
		 * Set length from the element
		 * Add this element to the Hash Map
		 */
		addDataElement(0x0040,0x0253, DicomConstants.DCM_DT_SH, StrPerformedProcedureStepID);
	}

	/**
	 * Return attribute identifies User or equipment generated identifier of that part of
	 * a Procedure that has been carried out within this procedure step.
	 * 
	 * @return String - String User or equipment generated identifier.
	 */
	public String getPerformedProcedureStepID()
	{
		Object objValue = getValue(0x0040,0x0253);
		if(objValue != null)
			return objValue.toString();
		return null;
	}



	/**
	 * Sets attribute identifies Date on which the General Purpose Performed Procedure Step ended.
	 * 
	 * @param strPerformedProcedureStepEndDate - String identifies Date on which the General Purpose Performed Procedure Step ended.
	 */	
	public void setPerformedProcedureStepEndDate(String strPerformedProcedureStepEndDate)
	{
		/*Accept Image identification characteristics in String Array format of type CS.
		 * Read the Transfer Syntax and check to create ImplicitDE or ExplicitDE .
		 * Set the iGroupNumber and iElementNumber to ImplicitDE object 
		 * Set the iVRType
		 * Set length from the element
		 * Add this element to the Hash Map
		 */
		addDataElement(0x0040,0x0250, DicomConstants.DCM_DT_DA, strPerformedProcedureStepEndDate);
	}

	/**
	 * Return identifies Date on which the General Purpose Performed Procedure Step ended.
	 * 
	 * @return String - String identifies Date on which the General Purpose Performed Procedure Step ended.
	 */
	public String getPerformedProcedureStepEndDate()
	{
		Object objValue = getValue(0x0040,0x0250);
		if(objValue != null)
			return objValue.toString();
		return null;
	}



	/**
	 * Sets Time at which the General Purpose Performed Procedure Step ended.
	 * 
	 * @param strPerformedProcedureStepEndTime - String Time at which the General Purpose Performed Procedure Step ended.
	 */	
	public void setPerformedProcedureStepEndTime(String strPerformedProcedureStepEndTime)
	{
		/*Accept Image identification characteristics in String Array format of type CS.
		 * Read the Transfer Syntax and check to create ImplicitDE or ExplicitDE .
		 * Set the iGroupNumber and iElementNumber to ImplicitDE object 
		 * Set the iVRType
		 * Set length from the element
		 * Add this element to the Hash Map
		 */
		addDataElement(0x0040,0x0251, DicomConstants.DCM_DT_TM, strPerformedProcedureStepEndTime);
	}

	/**
	 * Return Time at which the General Purpose Performed Procedure Step ended.
	 * 
	 * @return String - String Time at which the General Purpose Performed Procedure Step ended.
	 */
	public String getPerformedProcedureStepEndTime()
	{
		Object objValue = getValue(0x0040,0x0251);
		if(objValue != null)
			return objValue.toString();
		return null;
	}

	/**
	 * Sets Contains the state of the Performed Procedure Step.
	 * 
	 * @param enumGeneralPurposePerformedProcedureStepStatus - Enum value Contains the state of the Performed Procedure Step.
	 */
	public void setGeneralPurposePerformedProcedureStepStatus(EnumGeneralPurposePerformedProcedureStepStatus enumGeneralPurposePerformedProcedureStepStatus)
	{
		/* Accept Structure Set Label in String format of type US.
		 * Read the Transfer Syntax and check if ImplicitDE or ExplicitDE to create.
		 * Set the iGroupNumber and iElementNumber to ImplicitDE object 
		 * Set the iVRType
		 * Set length from the element
		 * Add this element to the Data Set
		 */
		addDataElement(0x0040,0x4002, DicomConstants.DCM_DT_CS, enumGeneralPurposePerformedProcedureStepStatus.getValue());
	}

	/**
	 * Retrieves value Contains the state of the Performed Procedure Step.
	 * 
	 * @return the general purpose performed procedure step status
	 */
	public String getGeneralPurposePerformedProcedureStepStatus()
	{
		Object objValue = getValue(0x0040,0x4002);
		if(objValue != null)
			return objValue.toString();
		return null;
	}



	/**
	 * Sets attribute identifies Institution-generated description or classification of the Procedure Step that was performed.
	 * 
	 * @param strPerformedProcedureStepDescription - String identifies description of Institution
	 */	
	public void setPerformedProcedureStepDescription(String strPerformedProcedureStepDescription)
	{
		/*Accept Image identification characteristics in String Array format of type CS.
		 * Read the Transfer Syntax and check to create ImplicitDE or ExplicitDE .
		 * Set the iGroupNumber and iElementNumber to ImplicitDE object 
		 * Set the iVRType
		 * Set length from the element
		 * Add this element to the Hash Map
		 */
		addDataElement(0x0040,0x0254, DicomConstants.DCM_DT_LO, strPerformedProcedureStepDescription);
	}

	/**
	 * Return attribute identifies Institution-generated description or classification of the Procedure Step that was performed.
	 * 
	 * @return String - String identifies description of Institution
	 */
	public String getPerformedProcedureStepDescription()
	{
		Object objValue = getValue(0x0040,0x0254);
		if(objValue != null)
			return objValue.toString();
		return null;
	}



	/**
	 * Sets attribute identifies User-defined comments on the Performed Procedure Step.
	 * 
	 * @param strCommentsonthePerformedProcedureStep - String identifies User-defined comments
	 */	
	public void setCommentsonthePerformedProcedureStep(String strCommentsonthePerformedProcedureStep)
	{
		/*Accept Image identification characteristics in String Array format of type CS.
		 * Read the Transfer Syntax and check to create ImplicitDE or ExplicitDE .
		 * Set the iGroupNumber and iElementNumber to ImplicitDE object 
		 * Set the iVRType
		 * Set length from the element
		 * Add this element to the Hash Map
		 */
		addDataElement(0x0040,0x0280, DicomConstants.DCM_DT_ST, strCommentsonthePerformedProcedureStep);
	}

	/**
	 * Return attribute identifies User-defined comments on the Performed Procedure Step.
	 * 
	 * @return String - String identifies the User-defined comments
	 */
	public String getCommentsonthePerformedProcedureStep()
	{
		Object objValue = getValue(0x0040,0x0280);
		if(objValue != null)
			return objValue.toString();
		return null;
	}

	/**
	 * Retrieves pre-initialized object of PerformedWorkitemCodeSequence.If the module contains the sequence object
	 * it returns the same otherwise it creates the sequence adds to the module with proper initialization
	 * and then returns the object of sequence
	 * 
	 * @return PerformedWorkitemCodeSequence - instance of Performed Work item Code Sequence
	 */
	public PerformedWorkitemCodeSequence getPerformedWorkitemCodeSequence()
	{
		PerformedWorkitemCodeSequence objPerformedWorkitemCodeSequence = (PerformedWorkitemCodeSequence)getDicomValue(0x0040,0x4019);
		if(objPerformedWorkitemCodeSequence == null)
		{
			/*
			 * If the sequence object is not present in the DataSet, a new sequence object is created and
			 * the TransferSyntax and DictionaryReader is set into it as it is set in the Module. This ensures that 
			 * the DataElements getting added in the DataSet follow the same TransferSyntax and use the same
			 * DictionaryReader object as that of the module.
			 */
			DicomV3Factory objDicomV3Factory = DicomV3Factory.createInstance();
			objPerformedWorkitemCodeSequence = (PerformedWorkitemCodeSequence)objDicomV3Factory.createSequence(0x0040,0x4019, objITransferSyntax, objIDictionaryReader);
			
			// This will add Data Element of SQ to the DataSet.
			addDataElement(0x0040,0x4019, DicomConstants.DCM_DT_SQ, objPerformedWorkitemCodeSequence.getValue());
		}
		return objPerformedWorkitemCodeSequence;
	}





}
