/*******************************************************************************
 *  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.DR;
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.HD;
import cdac.medinfo.sdk.hl7282.baselibs.ID;
import cdac.medinfo.sdk.hl7282.baselibs.PL;
import cdac.medinfo.sdk.hl7282.baselibs.XCN;
import cdac.medinfo.sdk.hl7282.commoninterface.IDataType;
import cdac.medinfo.sdk.hl7282.commoninterface.ISingleCollection;
import cdac.medinfo.sdk.hl7282.exceptions.InvalidSegmentException;
import cdac.medinfo.sdk.hl7282.utils.EnumSegments;
import cdac.medinfo.sdk.hl7282.utils.SingleCollection;

/**
 * PDA - Patient Death and Autopsy Segment<p>
 * This segment carries information on a patient's death and possible autopsy.
 * <p>Represents an HL7 PDA message segment. 
 * This segment has the following fields:</p><p>
 * PDA-1: Death Cause Code (CWE)<b>Optional</b><br> 
 * PDA-2: Death Location (PL)<b>Optional</b><br> 
 * PDA-3: Death Certified Indicator (ID)<b>Optional</b><br> 
 * PDA-4: Death Certificate Signed Date/Time (DTM)<b>Optional</b><br> 
 * PDA-5: Death Certified By (XCN)<b>Optional</b><br> 
 * PDA-6: Autopsy Indicator (ID)<b>Optional</b><br> 
 * PDA-7: Autopsy Start and End Date/Time (DR)<b>Optional</b><br> 
 * PDA-8: Autopsy Performed By (XCN)<b>Optional</b><br> 
 * PDA-9: Coroner Indicator (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 PDA extends Segment   
{
	

	/**
	 * Constucts the PDA segment.
	 */
	public PDA()
	{super(EnumSegments.HL7_SEG_PDA);
	}
	//Integer values used in getter/setter is unique item id defined 
	//for each attribute.

	/**
	 * Retrieves the Autopsy Indicator.
	 * This field indicates whether an autopsy is performed. 
	 * @return String - autopsyIndicator
	 */
	public ID getAutopsyIndicator() 
	{
		ISingleCollection<IDataType> objDataCollection =getDataType(1579);
		if(objDataCollection != null && objDataCollection.size() != 0) 
			return (ID)objDataCollection.elementAt(0);
		else
			return null;
	}

	/**
	 * Retrieves the Autopsy Performed By.
	 * This field is valued with the authority who performed the autopsy.
	 * @return XCN - autopsyPerformedBy
	 */
	public XCN getAutopsyPerformedBy()
	{
		ISingleCollection<IDataType> objDataCollection =getDataType(1581);
		if(objDataCollection != null && objDataCollection.size() != 0) 
			return (XCN)objDataCollection.elementAt(0);
		else
			return null;
	}

	/**
	 * Retrieves the Autopsy Start And End Date Time.
	 * This field specify the date and time that the autopsy is begin and completed.
	 * @return DR - autopsyStartAndEndDateTime
	 */
	public DR getAutopsyStartAndEndDateTime() 
	{
		ISingleCollection<IDataType> objDataCollection =getDataType(1580);
		if(objDataCollection != null && objDataCollection.size() != 0) 
			return (DR)objDataCollection.elementAt(0);
		else
			return null;
	}

	/**
	 * Retrieves the Coroner Indicator.
	 * This field indicates whether the case/death has been assigned to the coroner/medical 
	 * examiner for investigative purposed or not.  
	 * @return String - coronerIndicator
	 */
	public ID getCoronerIndicator() 
	{
		ISingleCollection<IDataType> objDataCollection =getDataType(1582);
		if(objDataCollection != null && objDataCollection.size() != 0) 
			return (ID)objDataCollection.elementAt(0);
		else
			return null;
	}

	/**
	 * Retrieves the Death Cause Code.
	 * This field specify the reason of the death.
	 * @return ISingleCollection<CE> - deathCauseCode
	 */
	public ISingleCollection<CWE> getDeathCauseCode() 
	{
		ISingleCollection<IDataType> objDataCollection =getDataType(1574);
		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;
	}

	/**
	 * Retrieves the Death Certificate Signed Date Time.
	 * This field specify the date and time of the death certificate is signed.
	 * @return DTM - deathCertificateSignedDateTime
	 */
	public DTM getDeathCertificateSignedDateTime() 
	{
		ISingleCollection<IDataType> objDataCollection =getDataType(1577);
		if(objDataCollection != null && objDataCollection.size() != 0) 
			return (DTM)objDataCollection.elementAt(0);
		else
			return null;
	}

	/**
	 * Retrieves the Death Certified By.
	 * This field is valued with the person who signed the death certificate.
	 * @return XCN - deathCertifiedBy
	 */
	public XCN getDeathCertifiedBy() 
	{
		ISingleCollection<IDataType> objDataCollection =getDataType(1578);
		if(objDataCollection != null && objDataCollection.size() != 0) 
			return (XCN)objDataCollection.elementAt(0);
		else
			return null;
	}

	/**
	 * Retrieves the Death Certified Indicator.
	 * This field indicates whether a death is officially certified or not.
	 * @return String - deathCertifiedIndicator
	 */
	public ID getDeathCertifiedIndicator() 
	{
		ISingleCollection<IDataType> objDataCollection =getDataType(1576);
		if(objDataCollection != null && objDataCollection.size() != 0) 
			return (ID)objDataCollection.elementAt(0);
		else
			return null;
	}

	/**
	 * Retrieves the Death Location.
	 * This field specify the place where the death occurred.
	 * @return PL - deathLocation
	 */
	public PL getDeathLocation() 
	{
		ISingleCollection<IDataType> objDataCollection =getDataType(1575);
		if(objDataCollection != null && objDataCollection.size() != 0) 
			return (PL)objDataCollection.elementAt(0);
		else
			return null;
	}

	/**
	 * Set the Death Cause Code.
	 * This field specify the reason of the death.
	  * @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 addDeathCauseCode (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 tempDeathCauseCode  = (CWE)getDataElement(1574);
		tempDeathCauseCode.setIdentifier(strIdentifier);
		tempDeathCauseCode.setText(strText);
		tempDeathCauseCode.setNameOfCodingSystem(strNameOfCodingSystem);
		tempDeathCauseCode.setAlternateIdentifier(strAlternateIdentifier);
		tempDeathCauseCode.setAlternateText(strAlternateText);
		tempDeathCauseCode.setNameOfAlternateCodingSystem(strNameOfAlternateCodingSystem); 
		tempDeathCauseCode.setCodingSystemVersionID(strCodingSystemVersionID);
		tempDeathCauseCode.setAlternateCodingSystemVersionId(strAlternateCodingSystemVersionId);
		tempDeathCauseCode.setOriginalText(strOriginalText);
		tempDeathCauseCode.setSecondAlternateIdentifier(strSecondAlternateIdentifier);
		tempDeathCauseCode.setSecondAlternateText(strSecondAlternateText);
		tempDeathCauseCode.setNameofSecondAlternateCodingSystem(strNameofSecondAlternateCodingSystem);
		tempDeathCauseCode.setSecondAlternateCodingSystemVersionID(strSecondAlternateCodingSystemVersionID);
		tempDeathCauseCode.setCodingSystemOID(strCodingSystemOID);
		tempDeathCauseCode.setValueSetOID(strValueSetOID);
		tempDeathCauseCode.setValueSetVersionID(strValueSetVersionID);
		tempDeathCauseCode.setAlternateCodingSystemOID(strAlternateCodingSystemOID);
		tempDeathCauseCode.setAlternateValueSetOID(strAlternateValueSetOID);
		tempDeathCauseCode.setAlternateValueSetVersionID(strAlternateValueSetVersionID);
		tempDeathCauseCode.setSecondAlternateCodingSystemOID(strSecondAlternateCodingSystemOID);
		tempDeathCauseCode.setSecondAlternateValueSetOID(strSecondAlternateValueSetOID);
		tempDeathCauseCode.setSecondAlternateValueSetVersionID(strSecondAlternateValueSetVersionID); 
		addDeathCauseCode(tempDeathCauseCode);

	} 

	/** Set the Death Cause Code.
	 * This field specify the reason of the death.
	 * @param objtempDeathCauseCode object of DeathCauseCode
	 */ 
	public void addDeathCauseCode(CWE objtempDeathCauseCode)
	{
		addDataType(1574,objtempDeathCauseCode);
	}

	/**
	 * Set the Death Cause Code.
	 * @param objDisabledPersonCodeList List of Death Cause Code.
	 */	
	@SuppressWarnings("unchecked")
	public void setDeathCauseCode(ISingleCollection<CWE> objDeathCauseCodeList)
	{
		ISingleCollection<IDataType> objCollection = null;
		ISingleCollection<?> objUnknownCollection = (ISingleCollection<?>)objDeathCauseCodeList;
		objCollection = (ISingleCollection<IDataType>)objUnknownCollection;
		setDataType(1574,objCollection);
	}
	/**
	 * Set the Death Location.
	 * This field specify the place where the death occurred.
	 * @param objPointOfCare Use as PointOfCare.
	 * @param objRoom Use as Room.
	 * @param objBed Use as Bed.
	 * @param objFacility Use as Facility.
	 * @param strLocationStatus Use as LocationStatus.
	 * @param strPersonLocationType Use as PersonLocationType.
	 * @param objBuilding Use as Building.
	 * @param objFloor Use as Floor.
	 * @param strLocationDescription Use as LocationDescription.
	 * @param objComprehensiveLocationIdentifier Use as ComprehensiveLocationIdentifier.
	 * @param objAssigningAuthorityForLocation Use as AssigningAuthorityForLocation.
	 */ 
	public void setDeathLocation (HD objPointOfCare, HD objRoom, HD objBed, HD objFacility,
			String strLocationStatus, String strPersonLocationType, HD objBuilding, HD objFloor, 
			String strLocationDescription, EI objComprehensiveLocationIdentifier, HD objAssigningAuthorityForLocation)
	{
		PL deathLocation  = (PL)getDataElement(1575);
		deathLocation.setPointOfCare(objPointOfCare);
		deathLocation.setRoom(objRoom);
		deathLocation.setBed(objBed);
		deathLocation.setFacility(objFacility);
		deathLocation.setLocationStatus(strLocationStatus);
		deathLocation.setPersonLocationType(strPersonLocationType);
		deathLocation.setBuilding(objBuilding);
		deathLocation.setFloor(objFloor);
		deathLocation.setLocationDescription(strLocationDescription);
		deathLocation.setComprehensiveLocationIdentifier(objComprehensiveLocationIdentifier);
		deathLocation.setAssigningAuthorityForLocation(objAssigningAuthorityForLocation); 
		setDeathLocation(deathLocation);

	} 

	/** Set the Death Location.
	 * This field specify the place where the death occurred.
	 * @param objdeathLocation object of  AssigningAuthorityForLocation.
	 */ 
	public void setDeathLocation(PL objdeathLocation)
	{
		setDataType(1575,objdeathLocation);

	}

	/**
	 * Set the Death Certified Indicator.
	 * This field indicates whether a death is officially certified or not.
	 * @param strDeathCertifiedIndicator Use as DeathCertifiedIndicator.
	 */ 
	public void setDeathCertifiedIndicator (String strDeathCertifiedIndicator)  
	{
		ID deathCertifiedIndicator = (ID)getDataElement(1576);
		deathCertifiedIndicator.setValue(strDeathCertifiedIndicator); 
		setDeathCertifiedIndicator(deathCertifiedIndicator);

	} 

	/** Set the Death Certified Indicator.
	 * This field indicates whether a death is officially certified or not.
	 * @param objdeathCertifiedIndicator object of DeathCertifiedIndicator.
	 */ 
	public void setDeathCertifiedIndicator(ID objdeathCertifiedIndicator)
	{
		setDataType(1576,objdeathCertifiedIndicator);

	}

	/**
	 * Set the Death Certificate Signed Date Time.
	 * This field specify the date and time of the death certificate is signed.
	 * @param strDateTimePlannedEvent This field contains the date/time that the event is planned.
	 */ 
	public void setDeathCertificateSignedDate_Time (String strDateTimePlannedEvent)  
	{
		DTM deathCertificateSignedDateTime  = (DTM)getDataElement(1577);
		deathCertificateSignedDateTime.setValue(strDateTimePlannedEvent);
		setDeathCertificateSignedDate_Time(deathCertificateSignedDateTime);

	} 

	/** Set the Death Certificate Signed Date Time.
	 * This field specify the date and time of the death certificate is signed.
	 * @param objdeathCertificateSignedDateTime object of DegreeOfPrecision.
	 */ 
	public void setDeathCertificateSignedDate_Time(DTM objdeathCertificateSignedDateTime)
	{
		setDataType(1577,objdeathCertificateSignedDateTime);

	}

	/**
	 * Set the Death Certified By.
	 * This field is valued with the person who signed the death certificate.
	 * @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 setDeathCertifiedBy (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 deathCertifiedBy  = (XCN)getDataElement(1578);
		deathCertifiedBy.setIdNumber(strIDNumber);
		deathCertifiedBy.setFamilyName(objFamilyName);
		deathCertifiedBy.setGivenName(strGivenName);
		deathCertifiedBy.setSecondNameOrInitials(strSecondAndFurtherGivenNamesOrInitialsThereof);
		deathCertifiedBy.setSuffix(strSuffix);
		deathCertifiedBy.setPrefix(strPrefix);
//		deathCertifiedBy.setDegree(strDegree);
		deathCertifiedBy.setSourceTable(objSourceTable);
		deathCertifiedBy.setAssigningAuthority(objAssigningAuthority);
		deathCertifiedBy.setNameTypeCode(strNameTypeCode);
		deathCertifiedBy.setIdentifierCheckDigit(strIdentifierCheckDigit);
		deathCertifiedBy.setCheckDigitScheme(strCheckDigitScheme);
		deathCertifiedBy.setIdentifierTypeCode(strIdentifierTypeCode);
		deathCertifiedBy.setAssigningFacility(objAssigningFacility);
		deathCertifiedBy.setNameRepresentationCode(strNameRepresentationCode);
		deathCertifiedBy.setNameContext(objNameContext);
//		deathCertifiedBy.setNameValidityRange(objNameValidityRange);
		deathCertifiedBy.setNameAssemblyOrder(strNameAssemblyOrder);
		deathCertifiedBy.setEffectiveDate(strEffectiveDate);
		deathCertifiedBy.setExpirationDate(strExpirationDate);
		deathCertifiedBy.setProfessionalSuffix(strProfessionalSuffix);
		deathCertifiedBy.setAssigningJurisdiction(objAssigningJurisdiction);
		deathCertifiedBy.setAssigningAgencyOrDepartment(objAssigningAgencyOrDepratment); 
		deathCertifiedBy.setSecurityCheck(strSecurityCheck);
		deathCertifiedBy.setSecurityCheckScheme(strSecurityCheckScheme);
		setDeathCertifiedBy(deathCertifiedBy);

	} 

	/** Sets the Death CertifiedBy.
	 * @param objdeathCertifiedBy object of Death CertifiedBy
	 */ 
	public void setDeathCertifiedBy(XCN objdeathCertifiedBy)
	{
		setDataType(1578,objdeathCertifiedBy);

	}

	/**
	 * Set the Autopsy Indicator.
	 * This field indicates whether an autopsy is performed. 
	 * @param strAutopsyIndicator Use as AutopsyIndicator.
	 */ 
	public void setAutopsyIndicator (String strAutopsyIndicator)  
	{
		ID autopsyIndicator = (ID)getDataElement(1579);
		autopsyIndicator.setValue(strAutopsyIndicator); 
		setAutopsyIndicator(autopsyIndicator);

	} 

	/** Set the Autopsy Indicator.
	 * This field indicates whether an autopsy is performed. 
	 * @param objautopsyIndicator object of AutopsyIndicator.
	 */ 
	public void setAutopsyIndicator(ID objautopsyIndicator)
	{
		setDataType(1579,objautopsyIndicator);

	}

	/**
	 * Set the Autopsy Start And End Date Time.
	 * This field specify the date and time that the autopsy is begin and completed.
	 * @param objRangeStartDate_Time Use as RangeStartDate_Time.
	 * @param objRangeEndDate_Time Use as RangeEndDate_Time.
	 */ 
	public void setAutopsyStartAndEndDateTime (DTM objRangeStartDate_Time, DTM objRangeEndDate_Time) 
	{
		DR autopsyStartAndEndDateTime = (DR)getDataElement(1580);
		autopsyStartAndEndDateTime.setRangeStartDateTime(objRangeStartDate_Time);
		autopsyStartAndEndDateTime.setRangeEndDateTime(objRangeEndDate_Time); 
		setAutopsyStartAndEndDateTime(autopsyStartAndEndDateTime);

	} 

	/** Set the Autopsy Start And End Date Time.
	 * This field specify the date and time that the autopsy is begin and completed.
	 * @param objautopsyStartAndEndDateTime object of AutopsyStartAndEndDateTime
	 */ 
	public void setAutopsyStartAndEndDateTime(DR objautopsyStartAndEndDateTime)
	{
		setDataType(1580,objautopsyStartAndEndDateTime);
	}

	/**
	 * Set the Autopsy Performed By.
	 * This field is valued with the authority who performed the autopsy.
	 * @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 setAutopsyPerformedBy (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 autopsyPerformedBy  = (XCN)getDataElement(1581);
		autopsyPerformedBy.setIdNumber(strIDNumber);
		autopsyPerformedBy.setFamilyName(objFamilyName);
		autopsyPerformedBy.setGivenName(strGivenName);
		autopsyPerformedBy.setSecondNameOrInitials(strSecondAndFurtherGivenNamesOrInitialsThereof);
		autopsyPerformedBy.setSuffix(strSuffix);
		autopsyPerformedBy.setPrefix(strPrefix);
//		autopsyPerformedBy.setDegree(strDegree);
		autopsyPerformedBy.setSourceTable(objSourceTable);
		autopsyPerformedBy.setAssigningAuthority(objAssigningAuthority);
		autopsyPerformedBy.setNameTypeCode(strNameTypeCode);
		autopsyPerformedBy.setIdentifierCheckDigit(strIdentifierCheckDigit);
		autopsyPerformedBy.setCheckDigitScheme(strCheckDigitScheme);
		autopsyPerformedBy.setIdentifierTypeCode(strIdentifierTypeCode);
		autopsyPerformedBy.setAssigningFacility(objAssigningFacility);
		autopsyPerformedBy.setNameRepresentationCode(strNameRepresentationCode);
		autopsyPerformedBy.setNameContext(objNameContext);
//		autopsyPerformedBy.setNameValidityRange(objNameValidityRange);
		autopsyPerformedBy.setNameAssemblyOrder(strNameAssemblyOrder);
		autopsyPerformedBy.setEffectiveDate(strEffectiveDate);
		autopsyPerformedBy.setExpirationDate(strExpirationDate);
		autopsyPerformedBy.setProfessionalSuffix(strProfessionalSuffix);
		autopsyPerformedBy.setAssigningJurisdiction(objAssigningJurisdiction);
		autopsyPerformedBy.setAssigningAgencyOrDepartment(objAssigningAgencyOrDepratment);
		autopsyPerformedBy.setSecurityCheck(strSecurityCheck);
		autopsyPerformedBy.setSecurityCheckScheme(strSecurityCheckScheme);
		setAutopsyPerformedBy(autopsyPerformedBy);

	} 

	/** Sets the Autopsy Performed By.
	 * @param objautopsyPerformedBy object of AutopsyPerformedBy
	 */ 
	public void setAutopsyPerformedBy(XCN objautopsyPerformedBy)
	{
		setDataType(1581,objautopsyPerformedBy);
	}

	/**
	 * Set the Coroner Indicator.
	 * This field indicates whether the case/death has been assigned to the coroner/medical 
	 * examiner for investigative purposed or not.  
	 * @param strCoronerIndicator Use as CoronerIndicator.
	 */ 
	public void setCoronerIndicator (String strCoronerIndicator)  
	{
		ID coronerIndicator = (ID)getDataElement(1582);
		coronerIndicator.setValue(strCoronerIndicator); 
		setCoronerIndicator(coronerIndicator);
	} 

	/** examiner for investigative purposed or not.  
	 * @param objcoronerIndicator object of  CoronerIndicator.
	 */ 
	public void setCoronerIndicator(ID objcoronerIndicator)
	{
		setDataType(1582,objcoronerIndicator);

	}	

	/**
	 * Validates HL7 Message objects .
	 * Validate method checks for validation each and every segments in side the Message object against specified message Structure. 
	 * Validation chcecks 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
	{
		//All fields are optional.
		//		This Segment Supports Feature Modes For Updating via Repeating Segment.
		//		Validation Mode for this segments validation doesn't affect.
		super.validate();
		return true;
	}
}