/*******************************************************************************
 *  Copyright 2017 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.hl7282.baselibs.segments;

import cdac.medinfo.sdk.hl7282.baselibs.CNE;
import cdac.medinfo.sdk.hl7282.baselibs.CWE;
import cdac.medinfo.sdk.hl7282.baselibs.DTM;
import cdac.medinfo.sdk.hl7282.commoninterface.IDataType;
import cdac.medinfo.sdk.hl7282.commoninterface.ISingleCollection;
import cdac.medinfo.sdk.hl7282.utils.EnumSegments;
import cdac.medinfo.sdk.hl7282.utils.SingleCollection;

/**
 * DPS - Diagnosis and Procedure Code Segment<p>
 * The Technical Steward for the PM1 segment is Orders and Observations.
 * For the payer  defined in PM1-1 and the service provider defined in MFE-4:
 * •	When MFI-1 is MLCP (Medical Limited Coverage Process) this segment is identifing what is in limited coverage.
 * •	When MFI-1 is MACP (Medical Approved Coverage Process) this segment is identifing what is approved. 
 * This segment defines the tests that are approved for a given Diagnosis Code based on the Procedure Code.
 * <p>Represents an HL7 DPS message segment. 
 * This segment has the following fields:</p><p>
 * DPS-1: Diagnosis Code - MCP (CWE)<b>Required</b><br> 
 * DPS-2: Procedure Code (CWE)<b>Required</b><br> 
 * DPS-3: Effective Date/Time (DTM)<b>Optional</b><br> 
 * DPS-4: Expiration Date/Time (DTM)<b>Optional</b><br> 
 * DPS-5: Type of Limitation (CNE)<b>Conditional</b><br> 
 * This class provides mechanism to validate message against HL7 v 2.8.2 standard.
 * The class provides accessors & mutators for the elements mentioned above.
 * The class has validate method which validates Message against HL7 v 2.8.2 standard.
 *
 * <p>User can also create Segment through {@link SegmentFactory}
 */
public class DPS extends Segment   
{
	

	/**
	 * Constructs the OMC segment.
	 */
	public DPS()
	{super(EnumSegments.HL7_SEG_DPS);}
	
	/**
	 * Retrieves the Diagnosis Code - MCP.
	 * DPS-1 contains the diagnosis code assigned to this diagnosis.    
	 * @return CWE - DiagnosisCode_MCP
	 */
	public CWE getDiagnosisCode_MCP() 
	{
		ISingleCollection<IDataType> objDataCollection =getDataType(3472);
		if(objDataCollection != null && objDataCollection.size() != 0) 
			return (CWE)objDataCollection.elementAt(0);
		else
			return null;
	}
	
	/**
	 * Set the Diagnosis Code - MCP.
	 * DPS-1 contains the diagnosis code assigned to this diagnosis.    
	 * @param strIdentifier Specifies of characters (the code) that uniquely identifies the item being referenced. 
	 * @param strText Specifies The descriptive or textual name of the identifier, e.g., myocardial infarction. 
	 * @param strNameOfCodingSystem Identifies the coding scheme being used in the identifier component.
	 * @param strAlternateIdentifier Specifies an alternate sequence of characters (the code) that uniquely identifies the item being referenced.
	 * @param strAlternateText Specifies the descriptive or textual name of the alternate identifier. See usage note in section introduction.
	 * @param strNameOfAlternateCodingSystem Identifies the coding scheme being used in the alternate identifier component. 
	 * @param strCodingSystemVersionID A sequence of characters that uniquely identifies a second alternate code.
	 * @param strAlternateCodingSystemVersionId This component carries the version for the coding system identified by components 4-6.
	 * @param strOriginalText The text as seen and/or selected by the user who entered the data.
	 * @param strSecondAlternateIdentifier A sequence of characters that uniquely identifies a second alternate code.
	 * @param strSecondAlternateText The descriptive or textual name of the alternate identifier.
	 * @param strNameofSecondAlternateCodingSystem Identifies the coding scheme being used in the alternate identifier component.
	 * @param strSecondAlternateCodingSystemVersionID This component carries the version for the coding system identified by components 10-12.
	 * @param strCodingSystemOID This component contains the ISO Object Identifier (OID) for the coding system or value set named in CWE.3.
	 * @param strValueSetOID This component contains the ISO Object Identifier (OID) to allow identification of the value set from which the value in CWE.1 is obtained.
	 * @param strValueSetVersionID This component carries the version for the value set identified by CWE.15. The version is a date. The date is the date/time that the value set being used was published.
	 * @param strAlternateCodingSystemOID This component contains the ISO Object Identifier (OID) for the coding system or value set named in CWE.6.
	 * @param strAlternateValueSetOID This component contains the ISO Object Identifier (OID) to allow identification of the value set from which the value in CWE.4 is obtained.
	 * @param strAlternateValueSetVersionID This component carries the version for the value set identified by CWE.18. The version is a date.
	 * @param strSecondAlternateCodingSystemOID This component contains the ISO Object Identifier (OID) for the coding system or value set named in CWE.12.
	 * @param strSecondAlternateValueSetOID This component contains the ISO Object Identifier (OID) to allow identification of the value set from which the value in CWE.10 is obtained.
	 * @param strSecondAlternateValueSetVersionID This component carries the version for the value set identified by CWE.21. The version is a date.
	 */
	public void setDiagnosisCode_MCP (String strIdentifier,String strText,String strNameOfCodingSystem,
			String strAlternateIdentifier,String strAlternateText,String strNameOfAlternateCodingSystem, String strCodingSystemVersionID, String strAlternateCodingSystemVersionId,
			String strOriginalText, String  strSecondAlternateIdentifier, String strSecondAlternateText, 
			String strNameofSecondAlternateCodingSystem, String strSecondAlternateCodingSystemVersionID, String strCodingSystemOID, String strValueSetOID,
			String strValueSetVersionID, String strAlternateCodingSystemOID, String strAlternateValueSetOID, String strAlternateValueSetVersionID,
			String  strSecondAlternateCodingSystemOID, String strSecondAlternateValueSetOID, String strSecondAlternateValueSetVersionID)
	{
		CWE cwe  = (CWE)getDataElement(3472);
		cwe.setIdentifier(strIdentifier);
		cwe.setText(strText);
		cwe.setNameOfCodingSystem(strNameOfCodingSystem);
		cwe.setAlternateIdentifier(strAlternateIdentifier);
		cwe.setAlternateText(strAlternateText);
		cwe.setNameOfAlternateCodingSystem(strNameOfAlternateCodingSystem); 
		cwe.setCodingSystemVersionID(strCodingSystemVersionID);
		cwe.setAlternateCodingSystemVersionId(strAlternateCodingSystemVersionId);
		cwe.setOriginalText(strOriginalText);
		cwe.setSecondAlternateIdentifier(strSecondAlternateIdentifier);
		cwe.setSecondAlternateText(strSecondAlternateText);
		cwe.setNameofSecondAlternateCodingSystem(strNameofSecondAlternateCodingSystem);
		cwe.setSecondAlternateCodingSystemVersionID(strSecondAlternateCodingSystemVersionID);
		cwe.setCodingSystemOID(strCodingSystemOID);
		cwe.setValueSetOID(strValueSetOID);
		cwe.setValueSetVersionID(strValueSetVersionID);
		cwe.setAlternateCodingSystemOID(strAlternateCodingSystemOID);
		cwe.setAlternateValueSetOID(strAlternateValueSetOID);
		cwe.setAlternateValueSetVersionID(strAlternateValueSetVersionID);
		cwe.setSecondAlternateCodingSystemOID(strSecondAlternateCodingSystemOID);
		cwe.setSecondAlternateValueSetOID(strSecondAlternateValueSetOID);
		cwe.setSecondAlternateValueSetVersionID(strSecondAlternateValueSetVersionID); 
		setDiagnosisCode_MCP(cwe);

	} 

	/** Set the Diagnosis Code - MCP.
	 * DPS-1 contains the diagnosis code assigned to this diagnosis.    
	 * @param objDiagnosisCode_MCP
	 */ 
	public void setDiagnosisCode_MCP(CWE objDiagnosisCode_MCP)
	{
		setDataType(3472,objDiagnosisCode_MCP);
	}
	
	/**
	 * Retrieves the Procedure Code.
	 * This field contains the procedure code for procedure, if any, associated with this charge description.
	 * @return ISingleCollection<CWE> - ProcedureCode
	 */
	public ISingleCollection<CWE> getProcedureCode() 
	{
		ISingleCollection<IDataType> objDataCollection =getDataType(3484);
		ISingleCollection<CWE> objDataList = new SingleCollection<CWE>(); 
		if(objDataCollection != null && objDataCollection.size() != 0)
		{
			for(IDataType objDataType : objDataCollection)
			{
				CWE objCWE = (CWE)objDataType;
				objDataList.add(objCWE);
			}
		}
		return objDataList;
	}
	
	/**
	 * Add the Procedure Code.
	 * This field contains the procedure code for procedure, if any, associated with this charge description.
	 * @param strIdentifier Specifies of characters (the code) that uniquely identifies the item being referenced. 
	 * @param strText Specifies The descriptive or textual name of the identifier, e.g., myocardial infarction. 
	 * @param strNameOfCodingSystem Identifies the coding scheme being used in the identifier component.
	 * @param strAlternateIdentifier Specifies an alternate sequence of characters (the code) that uniquely identifies the item being referenced.
	 * @param strAlternateText Specifies the descriptive or textual name of the alternate identifier. See usage note in section introduction.
	 * @param strNameOfAlternateCodingSystem Identifies the coding scheme being used in the alternate identifier component. 
	 * @param strCodingSystemVersionID A sequence of characters that uniquely identifies a second alternate code.
	 * @param strAlternateCodingSystemVersionId This component carries the version for the coding system identified by components 4-6.
	 * @param strOriginalText The text as seen and/or selected by the user who entered the data.
	 * @param strSecondAlternateIdentifier A sequence of characters that uniquely identifies a second alternate code.
	 * @param strSecondAlternateText The descriptive or textual name of the alternate identifier.
	 * @param strNameofSecondAlternateCodingSystem Identifies the coding scheme being used in the alternate identifier component.
	 * @param strSecondAlternateCodingSystemVersionID This component carries the version for the coding system identified by components 10-12.
	 * @param strCodingSystemOID This component contains the ISO Object Identifier (OID) for the coding system or value set named in CWE.3.
	 * @param strValueSetOID This component contains the ISO Object Identifier (OID) to allow identification of the value set from which the value in CWE.1 is obtained.
	 * @param strValueSetVersionID This component carries the version for the value set identified by CWE.15. The version is a date. The date is the date/time that the value set being used was published.
	 * @param strAlternateCodingSystemOID This component contains the ISO Object Identifier (OID) for the coding system or value set named in CWE.6.
	 * @param strAlternateValueSetOID This component contains the ISO Object Identifier (OID) to allow identification of the value set from which the value in CWE.4 is obtained.
	 * @param strAlternateValueSetVersionID This component carries the version for the value set identified by CWE.18. The version is a date.
	 * @param strSecondAlternateCodingSystemOID This component contains the ISO Object Identifier (OID) for the coding system or value set named in CWE.12.
	 * @param strSecondAlternateValueSetOID This component contains the ISO Object Identifier (OID) to allow identification of the value set from which the value in CWE.10 is obtained.
	 * @param strSecondAlternateValueSetVersionID This component carries the version for the value set identified by CWE.21. The version is a date.
	 */	 
	public void addProcedureCode (String strIdentifier,String strText,String strNameOfCodingSystem,
			String strAlternateIdentifier,String strAlternateText,String strNameOfAlternateCodingSystem, String strCodingSystemVersionID, String 				strAlternateCodingSystemVersionId,
			String strOriginalText, String  strSecondAlternateIdentifier, String strSecondAlternateText, 
			String strNameofSecondAlternateCodingSystem, String strSecondAlternateCodingSystemVersionID, String strCodingSystemOID, String strValueSetOID,
			String strValueSetVersionID, String strAlternateCodingSystemOID, String strAlternateValueSetOID, String strAlternateValueSetVersionID,
			String  strSecondAlternateCodingSystemOID, String strSecondAlternateValueSetOID, String strSecondAlternateValueSetVersionID)
	{
		CWE cwe  = (CWE)getDataElement(3484);
		cwe.setIdentifier(strIdentifier);
		cwe.setText(strText);
		cwe.setNameOfCodingSystem(strNameOfCodingSystem);
		cwe.setAlternateIdentifier(strAlternateIdentifier);
		cwe.setAlternateText(strAlternateText);
		cwe.setNameOfAlternateCodingSystem(strNameOfAlternateCodingSystem); 
		cwe.setCodingSystemVersionID(strCodingSystemVersionID);
		cwe.setAlternateCodingSystemVersionId(strAlternateCodingSystemVersionId);
		cwe.setOriginalText(strOriginalText);
		cwe.setSecondAlternateIdentifier(strSecondAlternateIdentifier);
		cwe.setSecondAlternateText(strSecondAlternateText);
		cwe.setNameofSecondAlternateCodingSystem(strNameofSecondAlternateCodingSystem);
		cwe.setSecondAlternateCodingSystemVersionID(strSecondAlternateCodingSystemVersionID);
		cwe.setCodingSystemOID(strCodingSystemOID);
		cwe.setValueSetOID(strValueSetOID);
		cwe.setValueSetVersionID(strValueSetVersionID);
		cwe.setAlternateCodingSystemOID(strAlternateCodingSystemOID);
		cwe.setAlternateValueSetOID(strAlternateValueSetOID);
		cwe.setAlternateValueSetVersionID(strAlternateValueSetVersionID);
		cwe.setSecondAlternateCodingSystemOID(strSecondAlternateCodingSystemOID);
		cwe.setSecondAlternateValueSetOID(strSecondAlternateValueSetOID);
		cwe.setSecondAlternateValueSetVersionID(strSecondAlternateValueSetVersionID);
		addProcedureCode(cwe);
	} 

	/** 
	 * Add the Procedure Code.
	 * This field contains the procedure code for procedure, if any, associated with this charge description.
	 * @param objProcedureCode Object of Procedure Code.
	 */ 
	public void addProcedureCode(CWE objProcedureCode)
	{
		addDataType(3484,objProcedureCode);
	} 

	/** 
	 * Set the Procedure Code.
	 * This field contains the procedure code for procedure, if any, associated with this charge description.
	 * @param objProcedureCodeList List of Procedure Code.
	 */ 
	@SuppressWarnings("unchecked")
	public void setProcedureCode(ISingleCollection<CWE> objProcedureCodeList)
	{
		ISingleCollection<IDataType> objCollection = null;
		ISingleCollection<?> objUnknownCollection = (ISingleCollection<?>)objProcedureCodeList;
		objCollection = (ISingleCollection<IDataType>)objUnknownCollection;
		setDataType(3484,objCollection);
	}
	
	/**
	 * Retrieves the Effective Date/Time.
	 * An optional effective date/time can be included for the record-level action specified.    
	 * @return DTM - EffectiveDateTime
	 */
	public DTM getEffectiveDateTime() 
	{
		ISingleCollection<IDataType> objDataCollection =getDataType(662);
		if(objDataCollection != null && objDataCollection.size() != 0) 
			return (DTM)objDataCollection.elementAt(0);
		else
			return null;
	}
	
	/**
	 * Set the Effective Date/Time.
	 * An optional effective date/time can be included for the record-level action specified.    
	 * @param strTime Specifies a point in time using a 24-hour clock notation. 
	 */ 
	public void setEffectiveDateTime (String strTime) 
	{
		DTM EffectiveDateTime  = (DTM)getDataElement(662);
		EffectiveDateTime.setValue(strTime);
		setEffectiveDateTime(EffectiveDateTime);

	} 

	/** 
	 * Set the Effective Date/Time.
	 * An optional effective date/time can be included for the record-level action specified.  
	 * @param objEffectiveDateTime Object of Effective Date/Time.
	 */ 
	public void setEffectiveDateTime(DTM objEffectiveDateTime)
	{
		setDataType(662,objEffectiveDateTime);
	}
	
	/**
	 * Retrieves the Expiration Date/Time.
	 * An optional expiration date/time can be included for the record-level action specified.  
	 * @return DTM - ExpirationDateTime
	 */
	public DTM getExpirationDateTime() 
	{
		ISingleCollection<IDataType> objDataCollection =getDataType(3473);
		if(objDataCollection != null && objDataCollection.size() != 0) 
			return (DTM)objDataCollection.elementAt(0);
		else
			return null;
	}
	
	/**
	 * Set the Expiration Date/Time.
	 * An optional expiration date/time can be included for the record-level action specified.  
	 * @param strTime Specifies a point in time using a 24-hour clock notation. 
	 */
	public void setExpirationDateTime(String strTime)
	{
		DTM ExpirationDateTime  = (DTM)getDataElement(3473);
		ExpirationDateTime.setValue(strTime);
		setExpirationDateTime(ExpirationDateTime);
	}

	/**
	 * Set the Expiration Date/Time.
	 * An optional expiration date/time can be included for the record-level action specified.  
	 * @param ExpirationDateTime Expiration Date/Time.
	 */
	public void setExpirationDateTime(DTM ExpirationDateTime)
	{
		setDataType(3473,ExpirationDateTime);
	}
	
	/**
	 * Retrieves the Type of Limitation.
	 * This field contains the type of  limitations as determined by the Payer.  
	 * @return CNE - TypeOfLimitation
	 */
	public CNE getTypeOfLimitation() 
	{
		ISingleCollection<IDataType> objDataCollection =getDataType(3474);
		if(objDataCollection != null && objDataCollection.size() != 0) 
			return (CNE)objDataCollection.elementAt(0);
		else
			return null;
	}
	
	/**
	 * Set the Type of Limitation.
	 * This field contains the type of  limitations as determined by the Payer.
	 * @param strIdentifier Specifies sequence of characters (the code) that uniquely identifies
	 * 						 the item being referenced by the CNE.
	 * @param strText Specifies descriptive or textual name of the identifier, e.g., myocardial infarction 
	 * @param strNameOfCodingSystem Specifies the coding scheme being used in the identifier component. 
	 * @param strAlternateIdentifier Specifies the local or user seen code as described. 
	 * @param strAlternateText Specifies descriptive or textual name of the alternate identifier.  
	 * @param strNameOfAlternateCodingSystem Specifies the coding scheme being used in the alternate identifier 
	 * 											component.  
	 * @param strCodingSystemVersionID Specifies the version ID for the coding system. 
	 * @param strAlternateCodingSystemVersionID Specifies the version ID for the coding system .
	 * @param strOriginalText Specifies the original text that was available to an automated process or a human 
	 * 							before a specific code was assigned.
	 * @param strSecondAlternateIdentifier Specifies a sequence of characters that uniquely identifies the second alternate code
	 * @param strSecondAlternateText Specifies a the textual information of the second alternate code
	 * @param strNameOfSecondAltenateCodingSystem Specifies the second coding scheme being used in the identifier component.
	 * @param strSecondAlternateCodingSystemVersionID Specifies version ID of Second alternative coding system.
	 * @param strCodingSystemOID contains the ISO Object identifier for the coding system.
	 * @param strValueSetOID contains the value set from which CNE-1 is obtained 
	 * @param strValueSetVersionID contains the version of the value set identified by CNE-15. 
	 * @param strAlternateCodingSystemOID contains the ISO Object identifier for the alternate coding system
	 * @param strAlternateValueSetOID contains the value set from which CNE-4 is obtained
	 * @param strAlternateValueSetVersionID contains the version of the value set identified by CNE-18. 
	 * @param strSecondAlternateCodingSystemOID contains the value set from which CNE-12 is obtained
	 * @param strSecondAlternateValueSetOID contains the value set from which CNE-10 is obtained
	 * @param strSecondAlternateValueSetVersionID contains the version of the value set identified by CNE-21. 
	 */ 
	public void setTypeOfLimitation (String strIdentifier,String strText,String strNameOfCodingSystem,String strAlternateIdentifier,
			String strAlternateText,String strNameOfAlternateCodingSystem,String strCodingSystemVersionID,
			String strAlternateCodingSystemVersionID,String strOriginalText, String strSecondAlternateIdentifier, String strSecondAlternateText,
			String strNameOfSecondAltenateCodingSystem, String strSecondAlternateCodingSystemVersionID, String strCodingSystemOID, 
			String strValueSetOID, String strValueSetVersionID, String strAlternateCodingSystemOID, String strAlternateValueSetOID,
			String strAlternateValueSetVersionID, String strSecondAlternateCodingSystemOID, String strSecondAlternateValueSetOID,
			String strSecondAlternateValueSetVersionID)
	{
		CNE TypeOfLimitation  = (CNE)getDataElement(3474);
		TypeOfLimitation.setIdentifier(strIdentifier);
		TypeOfLimitation.setText(strText);
		TypeOfLimitation.setNameOfCodingSystem(strNameOfCodingSystem);
		TypeOfLimitation.setAlternateIdentifier(strAlternateIdentifier);
		TypeOfLimitation.setAlternateText(strAlternateText);
		TypeOfLimitation.setNameOfAlternateCodingSystem(strNameOfAlternateCodingSystem);
		TypeOfLimitation.setCodingSystemVersionID(strCodingSystemVersionID);
		TypeOfLimitation.setAlternateCodingSystemVersionID(strAlternateCodingSystemVersionID);
		TypeOfLimitation.setOriginalText(strOriginalText); 
		TypeOfLimitation.setSecondAlternateIdentifier(strSecondAlternateIdentifier);
		TypeOfLimitation.setSecondAlternateText(strSecondAlternateText);
		TypeOfLimitation.setNameofSecondAlternateCodingSystem(strNameOfSecondAltenateCodingSystem);
		TypeOfLimitation.setSecondAlternateCodingSystemVersionID(strSecondAlternateCodingSystemVersionID);
		TypeOfLimitation.setCodingSystemOID(strCodingSystemOID);
		TypeOfLimitation.setValueSetOID(strValueSetOID);
		TypeOfLimitation.setValueSetVersionID(strValueSetVersionID);
		TypeOfLimitation.setAlternateCodingSystemOID(strAlternateCodingSystemOID);
		TypeOfLimitation.setAlternateValueSetOID(strAlternateValueSetOID);
		TypeOfLimitation.setAlternateValueSetVersionID(strAlternateValueSetVersionID);
		TypeOfLimitation.setSecondAlternateCodingSystemOID(strSecondAlternateCodingSystemOID);
		TypeOfLimitation.setSecondAlternateValueSetOID(strSecondAlternateValueSetOID);
		TypeOfLimitation.setSecondAlternateValueSetVersionID(strSecondAlternateValueSetVersionID);
		setTypeOfLimitation(TypeOfLimitation);

	} 

	/** Set the Type of Limitation.
	 * This field contains the type of  limitations as determined by the Payer.
	 * @param objTypeOfLimitation object of Type of Limitation.
	 */ 
	public void setTypeOfLimitation(CNE objTypeOfLimitation)
	{
		setDataType(3474,objTypeOfLimitation);
	}
}
