package cdac.medinfo.sdk.hl7282.hl7model.messages.materialsmanagement;

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

/**
 * SLT_S28 - Request New Sterilization Lot (Event S28).
 * A placer application (Sterilizer) sends a transaction with this trigger event to a filler application 
 * (Instrument-tracking system) to request that a new sterilization lot be added.  
 * <p>Represents a SLT_S28 message structure (see chapter 17.5.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: SLT (Sterilization Lot) <b>MULTIPLE_COMPULSARY</b><br>
 * The class provides accessors & mutators for the elements mentioned above.
 * These elements can be easily populated & populated values can be easily retrieved.
 * 
 * <p>Following is the step to create message<br>
 * Before that, respective Message Source and Message Recipient to be set on Message Factory.</p>
 * <p>SLT_S28 objS28 = (SLT_S28)MessageFactory.createInstance().createSendSupportedMessage("SLT", "S28");</p>
 */
public abstract class SLR_S28_Common extends Message
{
	/**
	 *  Constructs the SLR_S28 message.
	 */
	SLR_S28_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 - Specified UAC Segment
	 */
	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 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 Collection of Sterilization Lot(SLT) present in this message.
	 * @return ISingleCollection<SLT> - Collection of Sterilization Lot(SLT) present in this message.
	 */
	@SuppressWarnings("unchecked")
	public ISingleCollection<SLT> getSterilizationLotSegments()
	{
		ISingleCollection<?> objSegmentCollection = getSegment(EnumSegments.HL7_SEG_SLT);
		return (ISingleCollection<SLT>)objSegmentCollection;
	}

	/**
	 * Adds Sterilization Lot(SLT) to this message.
	 * @param objSLT Specified Sterilization Lot(SLT) to be added in this message.
	 */
	public void addSterilizationLotSegment(SLT objSLT)
	{
		addSegment(EnumSegments.HL7_SEG_SLT, objSLT);
	}

	/**
	 * Adds collection of Sterilization Lot(SLT) to this message.
	 * @param objSLTSegmentCollection Collection of Sterilization Lot(SLT) to add in this message
	 */
	@SuppressWarnings("unchecked")
	public void addSterilizationLotSegments(ISingleCollection<SLT>  objSLTSegmentCollection)
	{
		ISingleCollection<?> objSegmentCollection =  objSLTSegmentCollection;
		addSegment(EnumSegments.HL7_SEG_SLT, (ISingleCollection<ISegment>)objSegmentCollection);
	}
}
