/*******************************************************************************
 *  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.CWE;
import cdac.medinfo.sdk.hl7282.baselibs.DTM;
import cdac.medinfo.sdk.hl7282.baselibs.EI;
import cdac.medinfo.sdk.hl7282.baselibs.FN;
import cdac.medinfo.sdk.hl7282.baselibs.FT;
import cdac.medinfo.sdk.hl7282.baselibs.HD;
import cdac.medinfo.sdk.hl7282.baselibs.ID;
import cdac.medinfo.sdk.hl7282.baselibs.NM;
import cdac.medinfo.sdk.hl7282.baselibs.SAD;
import cdac.medinfo.sdk.hl7282.baselibs.XAD;
import cdac.medinfo.sdk.hl7282.baselibs.XCN;
import cdac.medinfo.sdk.hl7282.baselibs.XON;
import cdac.medinfo.sdk.hl7282.baselibs.XTN;
import cdac.medinfo.sdk.hl7282.commoninterface.IDataType;
import cdac.medinfo.sdk.hl7282.commoninterface.ISingleCollection;
import cdac.medinfo.sdk.hl7282.exceptions.FieldMissingException;
import cdac.medinfo.sdk.hl7282.exceptions.InvalidSegmentException;
import cdac.medinfo.sdk.hl7282.utils.EnumSegments;
import cdac.medinfo.sdk.hl7282.utils.SingleCollection;

/**
 * PES - Product Experience Sender Segment<p>
 * <p>Represents an HL7 PES message segment. 
 * This segment has the following fields:</p><p>
 * PES-1: Sender Organization Name (XON)<b>Optional</b><br> 
 * PES-2: Sender Individual Name (XCN)<b>Optional</b><br> 
 * PES-3: Sender Address (XAD)<b>Optional</b><br> 
 * PES-4: Sender Telephone (XTN)<b>Optional</b><br> 
 * PES-5: Sender Event Identifier (EI)<b>Optional</b><br> 
 * PES-6: Sender Sequence Number (NM)<b>Optional</b><br> 
 * PES-7: Sender Event Description (FT)<b>Optional</b><br> 
 * PES-8: Sender Comment (FT)<b>Optional</b><br> 
 * PES-9: Sender Aware Date/Time (TS)<b>Optional</b><br> 
 * PES-10: Event Report Date (TS)<b>Required</b><br> 
 * PES-11: Event Report Timing/Type (ID)<b>Optional</b><br> 
 * PES-12: Event Report Source (ID)<b>Optional</b><br> 
 * PES-13: Event Reported To (ID)<b>Optional</b><br><p> 
 * 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 PES extends Segment    
{
	

	/**
	 * Constructs the PES segment.
	 */
	public PES()
	{super(EnumSegments.HL7_SEG_PES);
	}

	//Integer values used in getter/setter is unique item id defined 
	//for each attribute.

	/**
	 * Retrieves the Event Report Date.
	 * This field contains the date the message was originally sent to the regulatory agency.
	 * @return DTM - eventReportDate
	 */
	public DTM getEventReportDate() 
	{
		ISingleCollection<IDataType> objDataCollection =getDataType(1069);
		if(objDataCollection != null && objDataCollection.size() != 0) 
			return (DTM)objDataCollection.elementAt(0);
		else
			return null;
	}

	/**
	 * Retrieves the Event Reported To.
	 * This field indicates all the entities to whom the entity submitting the report has reported the event. 
	 * @return ISingleCollection<ID> - eventReportedTo
	 */
	public ISingleCollection<ID> getEventReportedTo() 
	{
		ISingleCollection<IDataType> objDataCollection =getDataType(1072);
		ISingleCollection<ID> objDataList = new SingleCollection<ID>(); 
		if(objDataCollection != null && objDataCollection.size() != 0)
		{
			for(IDataType objDataType : objDataCollection)
			{
				ID objID = (ID)objDataType;
				objDataList.add(objID);
			}
		}
		return objDataList;
	}

	/**
	 * Retrieves the Event Report Source.
	 * This field identifies the source from which the sender learned about the event.  
	 * Multiple sources may be reported by repeating the element.
	 * @return ID - eventReportSource
	 */
	public ID getEventReportSource() 
	{
		ISingleCollection<IDataType> objDataCollection =getDataType(1071);
		if(objDataCollection != null && objDataCollection.size() != 0) 
			return (ID)objDataCollection.elementAt(0);
		else
			return null;
	}

	/**
	 * Retrieves the Event Report Timing Type.
	 * This field contains the timing type of report as required by regulatory agency.  
	 * @return ISingleCollection<ID> - eventReportTimingType
	 */
	public ISingleCollection<ID> getEventReportTimingType() 
	{
		ISingleCollection<IDataType> objDataCollection =getDataType(1070);
		ISingleCollection<ID> objDataList = new SingleCollection<ID>(); 
		if(objDataCollection != null && objDataCollection.size() != 0)
		{
			for(IDataType objDataType : objDataCollection)
			{
				ID objID = (ID)objDataType;
				objDataList.add(objID);
			}
		}
		return objDataList;
	}

	/**
	 * Retrieves the Sender Address.
	 * This field contains the postal address of the message sender to which correspondence 
	 * regarding the experience being reported should be directed.
	 * @return ISingleCollection<XAD> - senderAddress
	 */
	public ISingleCollection<XAD> getSenderAddress() 
	{
		ISingleCollection<IDataType> objDataCollection =getDataType(1062);
		ISingleCollection<XAD> objDataList = new SingleCollection<XAD>(); 
		if(objDataCollection != null && objDataCollection.size() != 0)
		{
			for(IDataType objDataType : objDataCollection)
			{
				XAD objXAD = (XAD)objDataType;
				objDataList.add(objXAD);
			}
		}
		return objDataList;
	}

	/**
	 * Retrieves the Sender Aware Date Time.
	 * This field identify the date and the sender become aware of the event.
	 * @return DTM - senderAwareDateTime
	 */
	public DTM getSenderAwareDateTime() 
	{
		ISingleCollection<IDataType> objDataCollection =getDataType(1068);
		if(objDataCollection != null && objDataCollection.size() != 0) 
			return (DTM)objDataCollection.elementAt(0);
		else
			return null;
	}

	/**
	 * Retrieves the Sender Comment.
	 * This field contains the text commentary regarding the report being made, such as 
	 * disclaimers, which is not necessarily part of the report.
	 * @return FT - senderComment
	 */
	public FT getSenderComment() 
	{
		ISingleCollection<IDataType> objDataCollection =getDataType(1067);
		if(objDataCollection != null && objDataCollection.size() != 0) 
			return (FT)objDataCollection.elementAt(0);
		else
			return null;
	}

	/**
	 * Retrieves the Sender Event Description.
	 * @return ISingleCollection<FT> - senderEventDescription
	 */
	public ISingleCollection<FT> getSenderEventDescription() 
	{
		ISingleCollection<IDataType> objDataCollection =getDataType(1066);
		ISingleCollection<FT> objDataList = new SingleCollection<FT>(); 
		if(objDataCollection != null && objDataCollection.size() != 0)
		{
			for(IDataType objDataType : objDataCollection)
			{
				FT objFT = (FT)objDataType;
				objDataList.add(objFT);
			}
		}
		return objDataList;
	}

	/**
	 * Retrieves the Sender Event Identifier.
	 * This field contains the product manufacturer's unique alphanumeric identifier for this specific event. 
	 * @return EI - senderEventIdentifier
	 */
	public EI getSenderEventIdentifier() 
	{
		ISingleCollection<IDataType> objDataCollection =getDataType(1064);
		if(objDataCollection != null && objDataCollection.size() != 0) 
			return (EI)objDataCollection.elementAt(0);
		else
			return null;
	}

	/**
	 * Retrieves the Sender Individual Name.  
	 * @return ISingleCollection<XCN> - senderIndividualName
	 */
	public ISingleCollection<XCN> getSenderIndividualName() 
	{
		ISingleCollection<IDataType> objDataCollection =getDataType(1060);
		ISingleCollection<XCN> objDataList = new SingleCollection<XCN>(); 
		if(objDataCollection != null && objDataCollection.size() != 0)
		{
			for(IDataType objDataType : objDataCollection)
			{
				XCN objXCN = (XCN)objDataType;
				objDataList.add(objXCN);
			}
		}
		return objDataList;
	}

	/**
	 * Retrieves the Sender Organization Name.
	 * @return ISingleCollection<XON> - senderOrganizationName
	 */
	public ISingleCollection<XON> getSenderOrganizationName() 
	{
		ISingleCollection<IDataType> objDataCollection =getDataType(1059);
		ISingleCollection<XON> objDataList = new SingleCollection<XON>(); 
		if(objDataCollection != null && objDataCollection.size() != 0)
		{
			for(IDataType objDataType : objDataCollection)
			{
				XON objXON = (XON)objDataType;
				objDataList.add(objXON);
			}
		}
		return objDataList;
	}

	/**
	 * Retrieves the Sender Sequence Number.
	 * This field contains sequentially assigned integer values which distinguish 
	 * messages which share the same sender event identification element. 
	 * @return NM - senderSequenceNumber
	 */
	public NM getSenderSequenceNumber() 
	{
		ISingleCollection<IDataType> objDataCollection =getDataType(1065);
		if(objDataCollection != null && objDataCollection.size() != 0) 
			return (NM)objDataCollection.elementAt(0);
		else
			return null;
	}

	/**
	 * Retrieves the Sender Telephone.
	 * This field contains the telephone number of the message sender to which 
	 * telephone communications regarding the experience being reported should be directed.  
	 * @return ISingleCollection<XTN> - senderTelephone
	 */
	public ISingleCollection<XTN> getSenderTelephone() 
	{
		ISingleCollection<IDataType> objDataCollection =getDataType(1063);
		ISingleCollection<XTN> objDataList = new SingleCollection<XTN>(); 
		if(objDataCollection != null && objDataCollection.size() != 0)
		{
			for(IDataType objDataType : objDataCollection)
			{
				XTN objXTN = (XTN)objDataType;
				objDataList.add(objXTN);
			}
		}
		return objDataList;
	}

	/**
	 * Set the Event Report Date.
	 * This field contains the date the message was originally sent to the regulatory agency.
	 * @param strTime Specifies a point in time using a 24-hour clock notation.	 
	 */ 
	public void setEventReportDate (String strTime) 
	{
		DTM eventReportDate  = (DTM)getDataElement(1069);
		eventReportDate.setValue(strTime);		 
		setEventReportDate(eventReportDate);

	} 

	/** 
	 * Set the Event Report Date.
	 * This field contains the date the message was originally sent to the regulatory agency.
	 * @param objeventReportDate Object of Event Report Date.
	 */ 
	public void setEventReportDate(DTM objeventReportDate)
	{
		setDataType(1069,objeventReportDate);

	}

	/**
	 * Add the Event Reported To.
	 * This field indicates all the entities to whom the entity submitting the report has reported the event.
	 * @param strEventReportedTo This field contains the String Value of Event Reported To 
	 */ 
	public void addEventReportedTo (String strEventReportedTo) 
	{
		ID objEventReportedTo  = (ID)getDataElement(1072);
		objEventReportedTo.setValue(strEventReportedTo); 
		addEventReportedTo(objEventReportedTo);

	} 

	/** 
	 * Add the Event Reported To.
	 * This field indicates all the entities to whom the entity submitting the report has reported the event.
	 * @param objEventReportedTo Object of Event Reported To.
	 */ 
	public void addEventReportedTo(ID objEventReportedTo)
	{
		addDataType(1072,objEventReportedTo);

	} 

	/** 
	 * Set the Event Reported To.
	 * This field indicates all the entities to whom the entity submitting the report has reported the event.
	 * @param objEventReportedToList List of Event Reported To.
	 */ 
	@SuppressWarnings("unchecked")
	public void setEventReportedTo(ISingleCollection<ID> objEventReportedToList)
	{
		ISingleCollection<IDataType> objCollection = null;
		ISingleCollection<?> objUnknownCollection = (ISingleCollection<?>)objEventReportedToList;
		objCollection = (ISingleCollection<IDataType>)objUnknownCollection;
		setDataType(1072,objCollection);
	}

	/**
	 * Set the Event Report Source.
	 * This field identifies the source from which the sender learned about the event.  
	 * Multiple sources may be reported by repeating the element.
	 * @param strEventReportSource This field contains the String Value of Event Report Source 
	 */ 
	public void setEventReportSource (String strEventReportSource) 
	{
		ID eventReportSource  = (ID)getDataElement(1071);
		eventReportSource.setValue(strEventReportSource); 
		setEventReportSource(eventReportSource);

	} 

	/** 
	 * Set the Event Report Source.
	 * This field identifies the source from which the sender learned about the event.  
	 * Multiple sources may be reported by repeating the element.
	 * @param objeventReportSource Object of Event Report Source.
	 */ 
	public void setEventReportSource(ID objeventReportSource)
	{
		setDataType(1071,objeventReportSource);

	}

	/**
	 * Add the Event Report Timing Type.
	 * This field contains the timing type of report as required by regulatory agency.  
	 * @param strEventReportTimingType This field contains the String Value of Event Report Timing Type 
	 */ 
	public void addEventReportTimingType (String strEventReportTimingType) 
	{
		ID eventReportTimingType  = (ID)getDataElement(1070);
		eventReportTimingType.setValue(strEventReportTimingType); 
		addEventReportTimingType(eventReportTimingType);

	} 

	/** 
	 * Add the Event Report Timing Type.
	 * This field contains the timing type of report as required by regulatory agency.  
	 * @param objeventReportTimingType Object of Event Report Timing Type.
	 */ 
	public void addEventReportTimingType(ID objeventReportTimingType)
	{
		addDataType(1070,objeventReportTimingType);

	} 

	/** 
	 * Set the Event Report Timing Type.
	 * This field contains the timing type of report as required by regulatory agency.  
	 * @param objeventReportTimingTypeList List of Event Report Timing Type.
	 */ 
	@SuppressWarnings("unchecked")
	public void setEventReportTimingType(ISingleCollection<ID> objeventReportTimingTypeList)
	{
		ISingleCollection<IDataType> objCollection = null;
		ISingleCollection<?> objUnknownCollection = (ISingleCollection<?>)objeventReportTimingTypeList;
		objCollection = (ISingleCollection<IDataType>)objUnknownCollection;
		setDataType(1070,objCollection);
	}

	/**
	 * Add the Sender Address.
	 * This field contains the postal address of the message sender to which correspondence 
	 * @param objStreetAddress Specifies the street address.
	 * @param strOtherDesignation Specifies the Second line of address. 
	 * @param strCity The city, or district or place where the addressee is located. 
	 * @param strStateOrProvince Specifies the state or province where the addressee is located.
	 * @param strZipOrPostalCode Specifies the zip or postal code where the addressee is located. 
	 * @param strCountry Specifies the country where the addressee is located.
	 * @param strAddressType Specifies the kind or type of address.
	 * @param strOtherGeographicDesignation Specifies any other geographic designation. 
	 * @param objCountyParishCode Specifies a code that represents the county in which the specified address resides. 
	 * @param objCensusTract Specifies a code that represents the census tract in which the specified address resides. 
	 * @param strAddressRepresentationCode Specifies representations of the same name/address Suggested values are I,A,P [Refer table 0465]
	 * @param objEffectiveDate It is The first date, if known, on which the address is valid and active.
	 * @param objExpirationDate It is The last date, if known, on which the address is valid and active.
	 * @param objExpirationReason indicates why this address was marked as ended.
	 * @param strTemporaryIndicator indicates whether address is considered temporary .
	 * @param strBadAddressIndicator indicates whether it is possible to contact the owning entity.
	 * @param strAddressUsage indicates how the address is intended to be used.
	 * @param strAddressee indicates the name of the person whose address is intended to be used.
	 * @param strComment indicated descriptive information
	 * @param strPreferenceOrder preference order
	 * @param objProtectionCode indicates that an address need to be protected
	 * @param objAdressIdentifier indicates a unique identifier for address
	 */  
	public void addSenderAddress (SAD objStreetAddress,String strOtherDesignation,String strCity,
			String strStateOrProvince,String strZipOrPostalCode,String strCountry,String strAddressType,
			String strOtherGeographicDesignation,CWE objCountyParishCode,CWE objCensusTract,
			String strAddressRepresentationCode,DTM objEffectiveDate,
			DTM objExpirationDate, CWE objEXpirationReason, String strTemporaryIndicator,
			String strBadAddressIndicator, String strAddressUsage, String strAddressee, String strComment,
			String strPreferenceOrder, CWE objProtectionCode, EI objAddressIdentifier)
	{
		XAD xad = (XAD)getDataElement(1062);
		xad.setStreetAddress(objStreetAddress);
		xad.setOtherDesignation(strOtherDesignation);
		xad.setCity(strCity);
		xad.setStateOrProvince(strStateOrProvince);
		xad.setZipOrPostalCode(strZipOrPostalCode);
		xad.setCountry(strCountry);
		xad.setAddressType(strAddressType);
		xad.setOtherGeographicDesignation(strOtherGeographicDesignation);
		xad.setCountyParishCode(objCountyParishCode);
		xad.setCensusTract(objCensusTract);
		xad.setAddressRepresentationCode(strAddressRepresentationCode);
 
		xad.setEffectiveDate(objEffectiveDate);
		xad.setExpirationDate(objExpirationDate); 
		xad.setExpirationReason(objEXpirationReason);
		xad.setTemporaryIndicator(strTemporaryIndicator);
		xad.setBadAddressIndicator(strBadAddressIndicator);
		xad.setAddressUsage(strAddressUsage);
		xad.setAddressee(strAddressee);
		xad.setComment(strComment);
		xad.setPreferenceOrder(strPreferenceOrder);
		xad.setProtectionCode(objProtectionCode);
		xad.setAddressIdentifier(objAddressIdentifier);
		addSenderAddress(xad);

	} 

	/** 
	 * Add the Sender Address.
	 * This field contains the postal address of the message sender to which correspondence 
	 * regarding the experience being reported should be directed.
	 * @param objSenderAddress Object of Sender Address.
	 */ 
	public void addSenderAddress(XAD objSenderAddress)
	{
		addDataType(1062,objSenderAddress);

	} 

	/** 
	 * Set the Sender Address.
	 * This field contains the postal address of the message sender to which correspondence 
	 * regarding the experience being reported should be directed.
	 * @param objSenderAddressList List of Sender Address.
	 */ 
	@SuppressWarnings("unchecked")
	public void setSenderAddress(ISingleCollection<XAD> objSenderAddressList)
	{
		ISingleCollection<IDataType> objCollection = null;
		ISingleCollection<?> objUnknownCollection = (ISingleCollection<?>)objSenderAddressList;
		objCollection = (ISingleCollection<IDataType>)objUnknownCollection;
		setDataType(1062,objCollection);
	}

	/**
	 * Set the Sender Aware Date Time.
	 * This field identify the date and the sender become aware of the event.
	 * @param strTime Specifies a point in time using a 24-hour clock notation.	 
	 */ 
	public void setSenderAwareDateTime (String strTime) 
	{
		DTM senderAwareDateTime  = (DTM)getDataElement(1068);
		senderAwareDateTime.setValue(strTime);		
		setSenderAwareDateTime(senderAwareDateTime);

	} 

	/** 
	 * Set the Sender Aware Date Time.
	 * This field identify the date and the sender become aware of the event.
	 * @param objsenderAwareDateTime Object of Sender Aware Date Time.
	 */ 
	public void setSenderAwareDateTime(DTM objsenderAwareDateTime)
	{
		setDataType(1068,objsenderAwareDateTime);

	}

	/**
	 * Set the Sender Comment.
	 * This field contains the text commentary regarding the report being made, such as 
	 * disclaimers, which is not necessarily part of the report.
	 * @param strSenderComment This field contains the String Value of Sender Comment 
	 */ 
	public void setSenderComment (String strSenderComment) 
	{
		FT senderComment  = (FT)getDataElement(1067);
		senderComment.setValue(strSenderComment); 
		setSenderComment(senderComment);

	} 

	/** 
	 * Set the Sender Comment.
	 * This field contains the text commentary regarding the report being made, such as 
	 * disclaimers, which is not necessarily part of the report.
	 * @param objsenderComment Object of Sender Comment.
	 */ 
	public void setSenderComment(FT objsenderComment)
	{
		setDataType(1067,objsenderComment);

	}

	/**
	 * Add the Sender Event Description.
	 * @param strSenderEventDescription This field contains the String Value of Sender Event Description 
	 */ 
	public void addSenderEventDescription (String strSenderEventDescription) 
	{
		FT objSenderEventDescription  = (FT)getDataElement(1066);
		objSenderEventDescription.setValue(strSenderEventDescription); 
		addSenderEventDescription(objSenderEventDescription);

	} 

	/** 
	 * Add the Sender Event Description.
	 * @param objSenderEventDescription Object of Sender Event Description.
	 */ 
	public void addSenderEventDescription(FT objSenderEventDescription)
	{
		addDataType(1066,objSenderEventDescription);

	}

	/** 
	 * Set the Sender Event Description.
	 * @param objSenderEventDescriptionList List of Sender Event Description.
	 */ 
	@SuppressWarnings("unchecked")
	public void setSenderEventDescription(ISingleCollection<FT> objSenderEventDescriptionList)
	{
		ISingleCollection<IDataType> objCollection = null;
		ISingleCollection<?> objUnknownCollection = (ISingleCollection<?>)objSenderEventDescriptionList;
		objCollection = (ISingleCollection<IDataType>)objUnknownCollection;
		setDataType(1066,objCollection);
	}

	/**
	 * Set the Sender Event Identifier.
	 * This field contains the product manufacturer's unique alphanumeric identifier for this specific event. 
	 * @param strEntityIdentifier Specifies defined by a hierarchic designator, represented by components 2 through 4.
	 * 								[Reference Section 2.A.33, "HD - hierarchic designator".] 
	 * @param strNamespaceId Specifies  the HL7 identifier for the user-defined table of values for this component.
	 * 						   [Refer to User-defined Table 0363 - Assigning authority] 	 
	 * @param strUniversalId Specifies string formatted according to the scheme defined by the component, 
	 * 							<universal ID type> (UID type). 
	 * @param strUniversalIdType Specifies  the interpretation of the second component of the HD. 
	 */ 
	public void setSenderEventIdentifier (String strEntityIdentifier,String strNamespaceId,String strUniversalId,String strUniversalIdType) 
	{
		EI senderEventIdentifier  = (EI)getDataElement(1064);
		senderEventIdentifier.setEntityIdentifier(strEntityIdentifier);
		senderEventIdentifier.setNamespaceId(strNamespaceId);
		senderEventIdentifier.setUniversalId(strUniversalId);
		senderEventIdentifier.setUniversalIdType(strUniversalIdType); 
		setSenderEventIdentifier(senderEventIdentifier);

	} 

	/** 
	 * Set the Sender Event Identifier.
	 * This field contains the product manufacturer's unique alphanumeric identifier for this specific event. 
	 * @param objsenderEventIdentifier Object of Sender Event Identifier.
	 */ 
	public void setSenderEventIdentifier(EI objsenderEventIdentifier)
	{
		setDataType(1064,objsenderEventIdentifier);

	}

	/**
	 * Add the Sender Individual Name.
	 * This field contains the name of the contact individual.
	 * @param strIDNumber Refers to the coded ID according to a user-defined table
	 * @param objFamilyName Specifies the surname of a person.
	 * @param strGivenName Specifies First name.
	 * @param strSecondAndFurtherGivenNamesOrInitialsThereof Specifies multiple middle names that may be included by 
	 * 														   separating them with spaces.
	 * @param strSuffix Used to specify a name suffix (e.g., Jr. or III).
	 * @param strPrefix Used to specify a name prefix (e.g., Dr.).
	 * @param strSourceTable Used as the HL7 identifier for the user-defined table of values for this component. [Refer User-defined Table 0297 - CN ID.]
	 * @param objAssigningAuthority Specifies a unique identifier of the system (or organization or agency of department)
	 * 								  that creates the data. [Refer User-defined Table 0363 - Assigning authority]
	 * @param strNameTypeCode Specifies a code that represents the type of name. 
	 * @param strIdentifierCheckDigit Specifies part of the identifying number used in the sending application. 
	 * @param strCheckDigitScheme Specifies the code identifying the check digit scheme employed.[Refer HL7 Table 0061 - Check digit scheme].
	 * @param strIdentifierTypeCode Specifies A code corresponding to the type of identifier.[Refer HL7 Table 0203 - Identifier type].
	 * @param objAssigningFacility Specifies the place or location identifier where the identifier was first assigned to the person
	 * @param strNameRepresentationCode Provides an indication of the representation provided by the data item.  
	 * @param objNameContext Designates the context in which a name is used. [Refer User-defined Table 0448 ]
	 * @param strNameAssemblyOrder Specifies a code that represents the preferred display order of the components of this person name. Suggested values are G,F[Refer table 0444.]
	 * @param strEffectiveDate Specifies the first date, if known, on which the address is valid and active.
	 * @param strExpirationDate Specifies the last date, if known, on which the address is valid and active.
	 * @param strProfessionalSuffix Used to specify an abbreviation, or a string of abbreviations, denoting qualifications that support the person's profession, (e.g., licenses).
	 * @param objAssigningJurisdiction Specifies the geo-political body that assigned the identifier.
	 * @param objAssigningAgencyOrDepratment Specifies the agency or department that assigned the identifier
	 * @param strSecurityCheck Specifies the version code that may be assigned to the person identifier
	 * @param strSecurityCheckScheme Specifies the check digit scheme.
	 */ 
	public void addSenderIndividualName (String strIDNumber,FN objFamilyName,String strGivenName,String strSecondAndFurtherGivenNamesOrInitialsThereof,
			String 	strSuffix,String strPrefix,CWE objSourceTable,HD objAssigningAuthority,
			String strNameTypeCode,String strIdentifierCheckDigit,String strCheckDigitScheme,String strIdentifierTypeCode,
			HD objAssigningFacility,String strNameRepresentationCode,CWE objNameContext,
			String strNameAssemblyOrder, String strEffectiveDate,String strExpirationDate,String strProfessionalSuffix,
			CWE objAssigningJurisdiction,CWE objAssigningAgencyOrDepratment, String strSecurityCheck, String strSecurityCheckScheme)
	{
		XCN xcn  = (XCN)getDataElement(1060);
		xcn.setIdNumber(strIDNumber);
		xcn.setFamilyName(objFamilyName);
		xcn.setGivenName(strGivenName);
		xcn.setSecondNameOrInitials(strSecondAndFurtherGivenNamesOrInitialsThereof);
		xcn.setSuffix(strSuffix);
		xcn.setPrefix(strPrefix);
 
		xcn.setSourceTable(objSourceTable);
		xcn.setAssigningAuthority(objAssigningAuthority);
		xcn.setNameTypeCode(strNameTypeCode);
		xcn.setIdentifierCheckDigit(strIdentifierCheckDigit);
		xcn.setCheckDigitScheme(strCheckDigitScheme);
		xcn.setIdentifierTypeCode(strIdentifierTypeCode);
		xcn.setAssigningFacility(objAssigningFacility);
		xcn.setNameRepresentationCode(strNameRepresentationCode);
		xcn.setNameContext(objNameContext);
 
		xcn.setNameAssemblyOrder(strNameAssemblyOrder);
		xcn.setEffectiveDate(strEffectiveDate);
		xcn.setExpirationDate(strExpirationDate);
		xcn.setProfessionalSuffix(strProfessionalSuffix);
		xcn.setAssigningJurisdiction(objAssigningJurisdiction);
		xcn.setAssigningAgencyOrDepartment(objAssigningAgencyOrDepratment); 
		xcn.setSecurityCheck(strSecurityCheck);
		xcn.setSecurityCheckScheme(strSecurityCheckScheme);
		addSenderIndividualName(xcn);

	} 

	/** 
	 * Add the Sender Individual Name.
	 * This field contains the name of the contact individual.
	 * @param objSenderIndividualName Object of Sender Individual Name.
	 */ 
	public void addSenderIndividualName(XCN objSenderIndividualName)
	{
		addDataType(1060,objSenderIndividualName);

	}

	/** 
	 * Set the Sender Individual Name.
	 * This field contains the name of the contact individual.
	 * @param objSenderIndividualNameList List of Sender Individual Name.
	 */ 
	@SuppressWarnings("unchecked")
	public void setSenderIndividualName(ISingleCollection<XCN> objSenderIndividualNameList)
	{
		ISingleCollection<IDataType> objCollection = null;
		ISingleCollection<?> objUnknownCollection = (ISingleCollection<?>)objSenderIndividualNameList;
		objCollection = (ISingleCollection<IDataType>)objUnknownCollection;
		setDataType(1060,objCollection);
	}

	/**
	 * Add the Sender Organization Name.
	 * This field contains the name of the organization sending the message.
	 * @param strOrganizationName Specifies name of the specified organization.
	 * @param strOrganizationNameTypeCode Specifies a code that represents the type of name i.e., legal name, display name.
	 * 										Suggested Values A,L,D,SL.[Refer to table No.0204]  
	 * @param objAssigningAuthority Specifies The assigning authority is a unique identifier of the system 
	 * 									(or organization or agency or department) that creates the data. 
	 * @param strIdentifierTypeCode Specifies a code corresponding to the type of identifier. 
	 * @param objAssigningFacility Specifies The place or location identifier where the identifier was first assigned to the person. 
	 * @param strNameRepresentationCode Specifies representations of the same name/address Suggested values are I,A,P [Refer table 0465] 
	 * @param strOrganizationIdentifier This component contains the sequence of characters (the code) that uniquely 
	 * 									  identifies the item being referenced by XON.1 Organization Name. 
	 * 									  This component replaces XON.3 ID Number as of v 2.5.
	 */ 
	public void addSenderOrganizationName (String strOrganizationName, CWE objOrganizationNameTypeCode,
			 HD objAssigningAuthority,
			String strIdentifierTypeCode, HD objAssigningFacility, String strNameRepresentationCode,
			String strOrganizationIdentifier)
	{
		XON xon  = (XON)getDataElement(1059);
		xon.setOrganizationName(strOrganizationName);
		xon.setOrganizationNameTypeCode(objOrganizationNameTypeCode);
		xon.setAssigningAuthority(objAssigningAuthority);
		xon.setIdentifierTypeCode(strIdentifierTypeCode);
		xon.setAssigningFacility(objAssigningFacility);
		xon.setNameRepresentationCode(strNameRepresentationCode);
		xon.setOrganizationIdentifier(strOrganizationIdentifier); 
		addSenderOrganizationName(xon);

	} 

	/** 
	 * Add the Sender Organization Name.
	 * This field contains the name of the organization sending the message.
	 * @param objSenderOrganizationName Object of Sender Organization Name. 
	 */ 
	public void addSenderOrganizationName(XON objSenderOrganizationName)
	{
		addDataType(1059,objSenderOrganizationName);

	}

	/** 
	 * Set the Sender Organization Name.
	 * @param objSenderOrganizationNameList List of Sender Organization Name. 
	 */ 
	@SuppressWarnings("unchecked")
	public void setSenderOrganizationName(ISingleCollection<XON> objSenderOrganizationNameList)
	{
		ISingleCollection<IDataType> objCollection = null;
		ISingleCollection<?> objUnknownCollection = (ISingleCollection<?>)objSenderOrganizationNameList;
		objCollection = (ISingleCollection<IDataType>)objUnknownCollection;
		setDataType(1059,objCollection);
	}

	/**
	 * Set the Sender Sequence Number.
	 * This field contains sequentially assigned integer values which distinguish 
	 * messages which share the same sender event identification element. 
	 * @param strSenderSequenceNumber This field contains the String Value of Sender Sequence Number 
	 */ 
	public void setSenderSequenceNumber (String strSenderSequenceNumber) 
	{
		NM senderSequenceNumber  = (NM)getDataElement(1065);
		senderSequenceNumber.setValue(strSenderSequenceNumber); 
		setSenderSequenceNumber(senderSequenceNumber);

	} 

	/** 
	 * Set the Sender Sequence Number.
	 * This field contains sequentially assigned integer values which distinguish 
	 * messages which share the same sender event identification element. 
	 * @param objsenderSequenceNumber Object of Sender Sequence Number.
	 */ 
	public void setSenderSequenceNumber(NM objsenderSequenceNumber)
	{
		setDataType(1065,objsenderSequenceNumber);

	}

	/**
	 * Add the Sender Telephone.
	 * This field contains the telephone number of the message sender to which 
	 * telephone communications regarding the experience being reported should be directed.  
	 * @param strTeleCommunicationUseCode Specifies a code that represents a specific use of a telecommunication number.
	 										Suggested values are PRN,ORN,WPN,VHN,ASN,EMR,NET,BPN  [Refer table 0201.]
	 * @param strTeleCommunicationEquipmentType Specifies a code that represents the type of telecommunication equipment.
	 * 											  Suggested values are PH,FX,MD,CP,BP,Internet,X.400,TDD,TTY  [Refer table 0202.]
	 * @param strCommuinicationAddress Specifies Email address.
	 * @param strCountryCode Specifies the Country code.
	 * @param strAreaCityCode Specifies the area /City Code.
	 * @param strLocalNumber Specifies an Local Number.
	 * @param strExtension Specifies an Extension.
	 * @param strAnyText Contains comments with respect to the telephone number.
	 * @param strExtensionPrefix Specifies the characters established within a company's 
	 * 							   internal telephone system network used as a prefix to the Extension component for internal dialing. 
	 * @param strSpeedDialCode Specifies The characters established within a 
	 * 							 company's internal telephone system used in place of the (external) telephone number.
	 * @param strUnformattedTelephoneNumber Specifies an expression of the telephone number as an unparsible string.
	 * @param strEffectiveStartDate Specifies start date.
	 * @param strExpirationDate Specifies expiration date.
	 * @param objExpirationReason Specifies reason why this contact is marked as ended.
	 * @param objProtectionCode Specifies reason why this information is sensitive or protected.
	 * @param objSharedTelecommunicationIdentifier Specifies a unique phone number phone telephone number or email-id.
	 * @param strPreferenceOrder Specifies the preference order for an entity..
	 */   
	public void addSenderTelephone (String strTeleCommunicationUseCode,String strTeleCommunicationEquipmentType
			,String strCommuinicationAddress,String strCountryCode,String strAreaCityCode,String strLocalNumber,String strExtension,String strAnyText,
			String strExtensionPrefix,String strSpeedDialCode,String strUnformattedTelephoneNumber, String strEffectiveStartDate, String strExpirationDate,
			CWE objExpirationReason, CWE objProtectionCode, EI objSharedTelecommunicationIdentifier, String strPreferenceOrder)
	{
		XTN xtn  = (XTN)getDataElement(1063);
//		xtn.setTelephoneNumber(strTelephoneNumber);
		xtn.setTelecommunicationUseCode(strTeleCommunicationUseCode);
		xtn.setTelecommunicationEquipmentType(strTeleCommunicationEquipmentType);
		xtn.setCommuinicationAddress(strCommuinicationAddress);
		xtn.setCountryCode(strCountryCode);
		xtn.setAreaCityCode(strAreaCityCode);
		xtn.setLocalNumber(strLocalNumber);
		xtn.setExtension(strExtension);
		xtn.setAnyText(strAnyText);
		xtn.setExtensionPrefix(strExtensionPrefix);
		xtn.setSpeedDialCode(strSpeedDialCode);
		xtn.setUnformattedTelephonenumber(strUnformattedTelephoneNumber); 
		xtn.setEffectiveStartDate(strEffectiveStartDate);
		xtn.setExpirationDate(strExpirationDate);
		xtn.setExpirationReason(objExpirationReason);
		xtn.setProtectionCode(objProtectionCode);
		xtn.setSharedTelecommunicationIdentifier(objSharedTelecommunicationIdentifier);
		xtn.setPreferenceOrder(strPreferenceOrder);
		addSenderTelephone(xtn);

	} 

	/** 
	 * Add the Sender Telephone.
	 * This field contains the telephone number of the message sender to which 
	 * telephone communications regarding the experience being reported should be directed.
	 * @param objSenderTelephone Object of Sender Telephone.
	 */ 
	public void addSenderTelephone(XTN objSenderTelephone)
	{
		addDataType(1063,objSenderTelephone);

	} 

	/** 
	 * Set the Sender Telephone.
	 * This field contains the telephone number of the message sender to which 
	 * telephone communications regarding the experience being reported should be directed.
	 * @param objSenderTelephoneList List of Sender Telephone.
	 */ 
	@SuppressWarnings("unchecked")
	public void setSenderTelephone(ISingleCollection<XTN> objSenderTelephoneList)
	{
		ISingleCollection<IDataType> objCollection = null;
		ISingleCollection<?> objUnknownCollection = (ISingleCollection<?>)objSenderTelephoneList;
		objCollection = (ISingleCollection<IDataType>)objUnknownCollection;
		setDataType(1063,objCollection);
	}

	/**
	 * Validates HL7 Message objects .
	 * Validate method checks for validation each and every segments in side the Message object against specified message Structure. 
	 * Validation checks include optionality of segment or group.
	 * It also verifies the number of times segment or group is repeated in message.
	 * e.g 
	 * {PSH} while parsing PSH segment validate method will check for its mandatory presence.
	 * [PSH] in this case validate will throw exception if one tries to enter more than one PSH segment.
	 * @return boolean - true or false.
	 * @throws InvalidSegmentException Throws when Segment Validation fails.
	 */
	public boolean validate()throws InvalidSegmentException
	{
		/*
		 * Event Report Date is Required field. 
		 */
		try
		{
			super.validate();

			return true;
		}
		catch(FieldMissingException ex)
		{
			throw new InvalidSegmentException(enumSegments.getValue(),ex);
		}
	}
}