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.UAC;
import cdac.medinfo.sdk.hl7282.commoninterface.IGroup;
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;

/**
 * SMD_S32 - Request Anti-Microbial Device Cycle Data (Event S32).
 * This trigger event is sent by the placer application to the filler application to request 
 * anti-microbial device cycle data created during the decontamination/sterilization of medical supplies.  
 * <p>Represents a SDR_S32 message structure (see chapter 17.5.5). 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: ANTI-MICROBIAL_DEVICE_CYCLE_DATA (a Group of segments in SMD_S32 message) <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>SMD_S32 objS32 = (SMD_S32)MessageFactory.createInstance().createSendSupportedMessage("SMD", "S32");</p>
 *
 */

public abstract class SDR_S32_Common extends Message
{
	/**
	 *  Constructs the SDR_S32 message.
	 */
	SDR_S32_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 ANTI-MICROBIAL_DEVICE_CYCLE_DATA  present in this message.
	 * @return ISingleCollection<Group> - Collection of ANTI-MICROBIAL_DEVICE_CYCLE_DATA  present in this Message
	 */
	public ISingleCollection<IGroup> getAntiMicrobialDeviceCycleDataGroups()
	{
		return getGroup(EnumSegments.HL7_GROUP_ANTI_MICROBIAL_DEVICE_CYCLE_DATA);
	}

	/**
	 * Adds Collection of ANTI-MICROBIAL_DEVICE_CYCLE_DATA  to this message.
	 * @param objSingleCollection - Specified ANTI-MICROBIAL_DEVICE_CYCLE_DATA  Collection
	 */
	public void addAntiMicrobialDeviceCycleDataGroups(ISingleCollection<IGroup> objSingleCollection)
	{
		addGroup(EnumSegments.HL7_GROUP_ANTI_MICROBIAL_DEVICE_CYCLE_DATA, objSingleCollection);
	}

	/**
	 * Adds ANTI-MICROBIAL_DEVICE_CYCLE_DATA  to this message.
	 * @param objGroup Specified ANTI-MICROBIAL_DEVICE_CYCLE_DATA 
	 */
	public void addAntiMicrobialDeviceCycleDataGroup(IGroup objGroup)
	{
		addGroup(EnumSegments.HL7_GROUP_ANTI_MICROBIAL_DEVICE_CYCLE_DATA, objGroup);
	}
	
}
