/*******************************************************************************
 *  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.clinicallaboratoryautomation;

import cdac.medinfo.sdk.hl7282.baselibs.messages.Message;
import cdac.medinfo.sdk.hl7282.baselibs.segments.EQP;
import cdac.medinfo.sdk.hl7282.baselibs.segments.EQU;
import cdac.medinfo.sdk.hl7282.baselibs.segments.SFT;
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;

/**
 * LSU_U12_Common - Automated Equipment Log/Service Update (Event U12 and U13).
 * This message is used to send log and/or service events from one application to
 * another (e.g., automated equipment to Laboratory Automation System).
 * <p>Represents a LSU_U12 message structure (see chapter 13.3.12). 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 Segment) <b>SINGLE_OPTIONAL</b><br>
 * 3: EQU (Equipment Detail Segment) <b></b><br>
 * 4: EQP (Equipment/log Service Segment) <b></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 LSU_U12_Common extends Message
{
	/**
	 * Constructs the LSU_U12 message.
	 */
	LSU_U12_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 Equipment Detail(EQU) segment present in this message
	 * @return EQU - the EQU Segment present in this message or null if unavailable.
	 */
	public EQU getEquipmentDetailSegment()
	{
		ISingleCollection<ISegment> objSingleCollection = getSegment(EnumSegments.HL7_SEG_EQU);
		if(objSingleCollection != null)
			return (EQU)objSingleCollection.elementAt(0);
		return null;
	}

	/**
	 * Sets value of Equipment Detail segment for this message,overwrites if already present.
	 * @param objEQU Specified EQU Segment 
	 */
	public void setEquipmentDetailSegment(EQU objEQU)
	{
		setSegment(EnumSegments.HL7_SEG_EQU,objEQU);
	}

	/**
	 * Retrieves Collection of Equipment Log/Service(EQP) present in this message.
	 * @return ISingleCollection<Segment> - Collection of IEquipment Log/Service(EQP) present in this message.
	 */
	@SuppressWarnings("unchecked")
	public ISingleCollection<EQP> getEquipmentLogOrService()
	{
		ISingleCollection<?> objSegmentCollection = getSegment(EnumSegments.HL7_SEG_EQP);
		return (ISingleCollection<EQP>)objSegmentCollection;
	}

	/** Adds Equipment Log/Service(EQP) to this message.
	 * @param objEQP Specified Equipment Log/Service(EQP) to this message. 
	 */
	public void addEquipmentLogOrService(EQP objEQP)
	{
		addSegment(EnumSegments.HL7_SEG_EQP, objEQP);
	}

	/**
	 * Adds collection of Equipment Log/Service(EQP) to this message.
	 * @param objEQPSegmentCollection Collection of Equipment Log/Service(EQP) to add in this message
	 */
	@SuppressWarnings("unchecked")
	public void addEquipmentLogOrService(ISingleCollection<EQP> objEQPSegmentCollection)
	{
		ISingleCollection<?> objSegmentCollection = objEQPSegmentCollection;
		addSegment(EnumSegments.HL7_SEG_EQP, (ISingleCollection<ISegment>)objSegmentCollection);
	}

	
}
