/*******************************************************************************
 *  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.hl7model.messages.personnelmanagement;

import cdac.medinfo.sdk.hl7282.baselibs.messages.Message;
import cdac.medinfo.sdk.hl7282.baselibs.segments.AFF;
import cdac.medinfo.sdk.hl7282.baselibs.segments.CER;
import cdac.medinfo.sdk.hl7282.baselibs.segments.EDU;
import cdac.medinfo.sdk.hl7282.baselibs.segments.EVN;
import cdac.medinfo.sdk.hl7282.baselibs.segments.LAN;
import cdac.medinfo.sdk.hl7282.baselibs.segments.NK1;
import cdac.medinfo.sdk.hl7282.baselibs.segments.ORG;
import cdac.medinfo.sdk.hl7282.baselibs.segments.PRA;
import cdac.medinfo.sdk.hl7282.baselibs.segments.PRT;
import cdac.medinfo.sdk.hl7282.baselibs.segments.ROL;
import cdac.medinfo.sdk.hl7282.baselibs.segments.SFT;
import cdac.medinfo.sdk.hl7282.baselibs.segments.STF;
import cdac.medinfo.sdk.hl7282.baselibs.segments.UAC;
import cdac.medinfo.sdk.hl7282.commoninterface.ISegment;
import cdac.medinfo.sdk.hl7282.commoninterface.ISingleCollection;
import cdac.medinfo.sdk.hl7282.utils.EnumSegments;
import cdac.medinfo.sdk.hl7282.utils.IMap;

/**
 * PMU_B01 - Add Personnel Record (Event B01).
 * An event B01 signals, to add a new record for healthcare administration information about an individual
 * healthcare practitioner establishing a relationship between that practitioner and the institution.
 * <p>Represents a PMU_B01 message structure (see chapter 15.3.1). This structure contains the 
 * following elements: </p>
 * 0: MSH (Message Header Segment) <b>SINGLE_COMPULSARY</b><br>
 * 1: SFT (Software Segment) <b>MULTIPLE_OPTIONAL</b><br>
 * 2: UAC (User Authentication Credential) <b>SINGLE_OPTIONAL</b><br>
 * 3: EVN (Event Type Segment) <b>SINGLE_COMPULSARY</b><br>
 * 4: STF (Staff Identification Segment) <b>SINGLE_COMPULSARY</b><br>
 * 5: PRA (Practitioner Detail Segment) <b>MULTIPLE_OPTIONAL</b><br>
 * 6: ORG (Practitioner Organization Unit Segment) <b>MULTIPLE_OPTIONAL</b><br>
 * 7: AFF (Professional Affiliation Segment) <b>MULTIPLE_OPTIONAL</b><br>
 * 8: LAN (Language Detail Segment) <b>MULTIPLE_OPTIONAL</b><br>
 * 9: EDU (Educational Detail Segment) <b>MULTIPLE_OPTIONAL</b><br>
 * 10: CER (Certificate Detail Segment) <b>MULTIPLE_OPTIONAL</b><br>
 * 11: NK1 (NextOfKin Segment) <b>MULTIPLE_OPTIONAL</b><br>
 * 12: PRT (Participation Segment) <b>MULTIPLE_OPTIONAL</b><br>
 * 13: ROL (Role Segment) <b>MULTIPLE_OPTIONAL</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.
 * These elements can be easily populated & populated values can be easily retrieved.
 * The class has validate method which validates Message against HL7 v 2.8.2 standard.
 */
public abstract class PMU_B01_Common extends Message
{
	/**
	 * Constructs the PMU_B01 message.
	 */
	PMU_B01_Common(IMap objMessageMap, String strTriggerEvent, String strMessageCode, String strMessageStructure)
	{
		super(objMessageMap, strTriggerEvent, strMessageCode, strMessageStructure);
	}

	/**
	 * Retrieves Collection of Software Segments(SFT) present in this message.
	 * @return ISingleCollection<SFT> - Collection of Software Segments(SFT) present in this message.
	 */
	@SuppressWarnings("unchecked")
	public ISingleCollection<SFT> getSoftwareSegments()
	{
		ISingleCollection<?> objSegmentCollection = getSegment(EnumSegments.HL7_SEG_SFT);
		return (ISingleCollection<SFT>)objSegmentCollection;
	}

	/**
	 * Adds Software Segment(SFT) to this message.
	 * @param objSFT Specified Software Segment(SFT) to be added in this messageto this message.
	 */
	public void addSoftwareSegment(SFT objSFT)
	{
		addSegment(EnumSegments.HL7_SEG_SFT, objSFT);
	}

	/**
	 * Adds collection of Software Segment(SFT) to this message.
	 * @param objSFTSegmentCollection Collection of Software Segments to add in this message
	 */
	@SuppressWarnings("unchecked")
	public void addSoftwareSegment(ISingleCollection<SFT>  objSFTSegmentCollection)
	{
		ISingleCollection<?> objSegmentCollection =  objSFTSegmentCollection;
		addSegment(EnumSegments.HL7_SEG_SFT, (ISingleCollection<ISegment>)objSegmentCollection);
	}
	
	/**
	 * Retrieves User Authentication Credential(UAC) segment present in this message
	 * @return UAC - the User Authentication Credential Segment present in this message or null if unavailable. 
	 */
	public UAC getUserAuthenticationCredentialSegment()
	{
		ISingleCollection<ISegment> objSingleCollection = getSegment(EnumSegments.HL7_SEG_UAC);
		if(objSingleCollection != null)
			return (UAC)objSingleCollection.elementAt(0);
		return null;
	}
	
	/**
	 * Sets value of User Authentication Credential(UAC) segment  for this message, overwrites if already present.
	 * @param objUAC Specified UAC Segment
	 */
	public void setUserAuthenticationCredentialSegment(UAC objUAC)
	{
		setSegment(EnumSegments.HL7_SEG_UAC,objUAC);
	}

	/**
	 * Retrieves Event Type(EVN) segment present in this message
	 * @return EVN - the EVN Segment present in this message or null if unavailable.
	 */
	public EVN getEventTypeSegment()
	{
		ISingleCollection<ISegment> objSingleCollection = getSegment(EnumSegments.HL7_SEG_EVN);
		if(objSingleCollection != null)
			return (EVN)objSingleCollection.elementAt(0);
		return null;
	}

	/**
	 * Sets value of Event Type segment for this message,overwrites if already present.
	 * @param objEVN Specified EVN Segment 
	 */
	public void setEventTypeSegment(EVN objEVN)
	{
		setSegment(EnumSegments.HL7_SEG_EVN,objEVN);
	}

	/**
	 * Sets value of Staff segment for this message,overwrites if already present.
	 * @param objSTF Specified Staff Segment 
	 */
	public void setStaffSegment(STF objSTF)
	{
		setSegment(EnumSegments.HL7_SEG_STF,objSTF);
	}

	/**
	 * Retrieves Staff(STF) segment present in this message
	 * @return STF - the STF Segment present in this message or null if unavailable.
	 */
	public STF getStaffTypeSegment()
	{
		ISingleCollection<ISegment> objSingleCollection = getSegment(EnumSegments.HL7_SEG_STF);
		if(objSingleCollection != null)
			return (STF)objSingleCollection.elementAt(0);
		return null;
	}

	/**
	 * Retrieves Collection of Practitioner Segments(PRA) present in this message.
	 * @return ISingleCollection<PRA> - Collection of Practitioner Segments(PRA) present in this message.
	 */
	@SuppressWarnings("unchecked")
	public ISingleCollection<PRA> getPractitionerSegments()
	{
		ISingleCollection<?> objSegmentCollection = getSegment(EnumSegments.HL7_SEG_PRA);
		return (ISingleCollection<PRA>)objSegmentCollection;
	}

	/**
	 * Adds Practitioner Segment(PRA) to this message.
	 * @param objPRA Specified Practitioner Segment(PRA) 
	 */
	public void addPractitionerSegment(PRA objPRA)
	{
		addSegment(EnumSegments.HL7_SEG_PRA, objPRA);
	}

	/**
	 * Adds collection of Practitioner Segment(PRA) to this message.
	 * @param objPRASegmentCollection Collection of Practitioner Segments 
	 */
	@SuppressWarnings("unchecked")
	public void addPractitionerSegments(ISingleCollection<PRA>  objPRASegmentCollection)
	{
		ISingleCollection<?> objSegmentCollection =  objPRASegmentCollection;
		addSegment(EnumSegments.HL7_SEG_PRA, (ISingleCollection<ISegment>)objSegmentCollection);
	}

	/**
	 * Retrieves Collection of Organization Segments(ORG) present in this message.
	 * @return ISingleCollection<ORG> - Collection of Organization Segments(ORG) present in this message.
	 */
	@SuppressWarnings("unchecked")
	public ISingleCollection<ORG> getOrganizationSegments()
	{
		ISingleCollection<?> objSegmentCollection = getSegment(EnumSegments.HL7_SEG_ORG);
		return (ISingleCollection<ORG>)objSegmentCollection;
	}

	/**
	 * Adds Organization Segment(ORG) to this message.
	 * @param objORG Specified Organization Segment(ORG) 
	 */
	public void addOrganizationSegment(ORG objORG)
	{
		addSegment(EnumSegments.HL7_SEG_ORG, objORG);
	}

	/**
	 * Adds collection of Organization Segment(ORG) to this message.
	 * @param objSegmentORGCollection Collection of Organization Segments 
	 */
	@SuppressWarnings("unchecked")
	public void addOrganizationSegments(ISingleCollection<ORG>  objSegmentORGCollection)
	{
		ISingleCollection<?> objSegmentCollection =  objSegmentORGCollection;
		addSegment(EnumSegments.HL7_SEG_ORG, (ISingleCollection<ISegment>)objSegmentCollection);
	}

	/**
	 * Retrieves Collection of Affiliation Segments(AFF) present in this message.
	 * @return ISingleCollection<AFF> - Collection of Affiliation Segments(AFF) present in this message.
	 */
	@SuppressWarnings("unchecked")
	public ISingleCollection<AFF> getAffiliationSegments()
	{
		ISingleCollection<?> objSegmentCollection = getSegment(EnumSegments.HL7_SEG_AFF);
		return (ISingleCollection<AFF>)objSegmentCollection;
	}

	/**
	 * Adds Affiliation Segment(AFF) to this message.
	 * @param objAFF Specified Affiliation Segment(AFF) 
	 */
	public void addAffiliationSegment(AFF objAFF)
	{
		addSegment(EnumSegments.HL7_SEG_AFF, objAFF);
	}

	/**
	 * Adds collection of Affiliation Segment(AFF) to this message.
	 * @param objAFFSegmentCollection Collection of Affiliation Segments 
	 */
	@SuppressWarnings("unchecked")
	public void addAffiliationSegments(ISingleCollection<AFF>  objAFFSegmentCollection)
	{
		ISingleCollection<?> objSegmentCollection =  objAFFSegmentCollection;
		addSegment(EnumSegments.HL7_SEG_AFF, (ISingleCollection<ISegment>)objSegmentCollection);
	}	

	/**
	 *  Retrieves Collection of Language Segments(LAN) present in this message.
	 * @return ISingleCollection<LAN> - Collection of Language Segments(LAN) present in this message.
	 */
	@SuppressWarnings("unchecked")
	public ISingleCollection<LAN> getLanguageSegments()
	{
		ISingleCollection<?> objSegmentCollection = getSegment(EnumSegments.HL7_SEG_LAN);
		return (ISingleCollection<LAN>)objSegmentCollection;
	}

	/**
	 * Adds Language Segment(LAN) to this message.
	 * @param objLAN Specified Language Segment(LAN) 
	 */
	public void addLanguageSegment(LAN objLAN)
	{
		addSegment(EnumSegments.HL7_SEG_LAN, objLAN);
	}

	/**
	 * Adds collection of Language Segment(LAN) to this message.
	 * @param objLANSegmentCollection Collection of Language Segments 
	 */
	@SuppressWarnings("unchecked")
	public void addLanguageSegments(ISingleCollection<LAN>  objLANSegmentCollection)
	{
		ISingleCollection<?> objSegmentCollection =  objLANSegmentCollection;
		addSegment(EnumSegments.HL7_SEG_LAN, (ISingleCollection<ISegment>)objSegmentCollection);
	}

	/**
	 *  Retrieves Collection of Education Segments(EDU) present in this message.
	 * @return ISingleCollection<EDU> - Collection of Education Segments(EDU) present in this message.
	 */
	@SuppressWarnings("unchecked")
	public ISingleCollection<EDU> getEducationSegments()
	{
		ISingleCollection<?> objSegmentCollection = getSegment(EnumSegments.HL7_SEG_EDU);
		return (ISingleCollection<EDU>)objSegmentCollection;
	}

	/**
	 * Adds Education Segment(EDU) to this message.
	 * @param objEDU Specified Education Segment(EDU) 
	 */
	public void addEducationSegment(EDU objEDU)
	{
		addSegment(EnumSegments.HL7_SEG_EDU, objEDU);
	}

	/**
	 * Adds collection of Education Segment(EDU) to this message.
	 * @param objEDUSegmentCollection Collection of Education Segments 
	 */
	@SuppressWarnings("unchecked")
	public void addEducationSegments(ISingleCollection<EDU>  objEDUSegmentCollection)
	{
		ISingleCollection<?> objSegmentCollection =  objEDUSegmentCollection;
		addSegment(EnumSegments.HL7_SEG_EDU, (ISingleCollection<ISegment>)objSegmentCollection);
	}

	/**
	 * Retrieves Collection of Certificate Segments(CER) present in this message.
	 * @return ISingleCollection<CER> - Collection of Certificate Segments(CER) present in this message.
	 */
	@SuppressWarnings("unchecked")
	public ISingleCollection<CER> getCertificateSegments()
	{
		ISingleCollection<?> objSegmentCollection = getSegment(EnumSegments.HL7_SEG_CER);
		return (ISingleCollection<CER>)objSegmentCollection;
	}

	/**
	 * Adds Certificate Segment(CER) to this message.
	 * @param objCER Specified Certificate Segment(CER) 
	 */
	public void addCertificateSegment(CER objCER)
	{
		addSegment(EnumSegments.HL7_SEG_CER, objCER);
	}

	/**
	 * Adds collection of Certificate Segment(CER) to this message.
	 * @param objCERSegmentCollection Collection of Certificate Segments 
	 */
	@SuppressWarnings("unchecked")
	public void addCertificateSegments(ISingleCollection<CER>  objCERSegmentCollection)
	{
		ISingleCollection<?> objSegmentCollection =  objCERSegmentCollection;
		addSegment(EnumSegments.HL7_SEG_CER, (ISingleCollection<ISegment>)objSegmentCollection);
	}
	
	/**
	 * Retrieves Collection of NextOfKin (NK1) Segment present in this message.
	 * @return ISingleCollection<NK1> - Collection of NextOfKin (NK1) Segment present in this message.
	 */
	@SuppressWarnings("unchecked")
	public ISingleCollection<NK1> getNextOfKinSegments()
	{
		ISingleCollection<?> objSegmentCollection = getSegment(EnumSegments.HL7_SEG_NK1);
		return (ISingleCollection<NK1>)objSegmentCollection;
	}

	/**
	 * Adds NextOfKin (NK1) Segment to this message.
	 * @param objNK1 Specified NextOfKin (NK1) Segment 
	 */
	public void addNextOfKinSegment(NK1 objNK1)
	{
		addSegment(EnumSegments.HL7_SEG_NK1, objNK1);
	}

	/**
	 * Adds collection of NextOfKin (NK1) Segment to this message.
	 * @param objNK1SegmentCollection Collection of NextOfKin (NK1) Segment
	 */
	@SuppressWarnings("unchecked")
	public void addNextOfKinSegments(ISingleCollection<NK1>  objNK1SegmentCollection)
	{
		ISingleCollection<?> objSegmentCollection =  objNK1SegmentCollection;
		addSegment(EnumSegments.HL7_SEG_NK1, (ISingleCollection<ISegment>)objSegmentCollection);
	}
	
	/**
	 * Retrieves Collection of Participation(PRT) Segment present in this message.
	 * @return ISingleCollection<PRT> - collection of Participation(PRT) Segment present in message.
	 */
	@SuppressWarnings("unchecked")
	public ISingleCollection<PRT> getParticipationSegments()
	{
		ISingleCollection<?> objSegmentCollection = getSegment(EnumSegments.HL7_SEG_PRT);
		return (ISingleCollection<PRT>)objSegmentCollection;
	}
	
	/**
	 * Adds Participation(PRT) Segment to this message.
	 * @param objPRT Specified Participation(PRT) Segment to be added in this message.
	 */
	public void addParticipationSegment(PRT objPRT)
	{
		addSegment(EnumSegments.HL7_SEG_PRT, objPRT);
	}

	/**
	 * Adds collection of PArticipation(PRT) Segment to this message.
	 * @param objPRTSegmentCollection Collection of Participation Segments to add in this message
	 */
	@SuppressWarnings("unchecked")
	public void addPaticipationSegments(ISingleCollection<PRT> objPRTSegmentCollection)
	{
		ISingleCollection<?> objSegmentCollection = objPRTSegmentCollection;
		addSegment(EnumSegments.HL7_SEG_PRT, (ISingleCollection<ISegment>)objSegmentCollection);
	}
	
	/**
	 * Retrieves Collection of Role Segments(ROL) present in this message.
	 * @return ISingleCollection<ROL> - Collection of Role Segments(ROL) present in this message.
	 */
	@SuppressWarnings("unchecked")
	public ISingleCollection<ROL> getRoleSegments()
	{
		ISingleCollection<?> objSegmentCollection = getSegment(EnumSegments.HL7_SEG_ROL);
		return (ISingleCollection<ROL>)objSegmentCollection;
	}

	/**
	 * Adds Certificate Segment(CER) to this message.
	 * @param objROL Specified Certificate Segment(CER) 
	 */
	public void addRoleSegment(ROL objROL)
	{
		addSegment(EnumSegments.HL7_SEG_ROL, objROL);
	}

	/**
	 * Adds collection of Role Segment(ROL) to this message.
	 * @param objROLSegmentCollection Collection of Role Segments 
	 */
	@SuppressWarnings("unchecked")
	public void addRoleSegments(ISingleCollection<ROL>  objROLSegmentCollection)
	{
		ISingleCollection<?> objSegmentCollection =  objROLSegmentCollection;
		addSegment(EnumSegments.HL7_SEG_ROL, (ISingleCollection<ISegment>)objSegmentCollection);
	}

}
