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

import cdac.medinfo.sdk.hl7282.commoninterface.ISegmentKey;
import cdac.medinfo.sdk.hl7282.utils.EnumSegmentCardinality;
import cdac.medinfo.sdk.hl7282.utils.IMap;
import cdac.medinfo.sdk.hl7282.utils.ISegmentItem;

/**
 * SegmentItem class represents structure of a Segment. 
 * It provides getters/setters to specify structure for a segment.
 */
public final class SegmentItem implements ISegmentItem
{
	

	private EnumSegmentCardinality enumSegmentCardinality;
	private ISegmentKey enumName ;
	private IMap objGroupItemMessageMap = null;
	private boolean isGroup = false;

	/**
	 * Retrieves Name of segment
	 * @return ISegmentKey Specified enumeration showing segment name
	 */
	public ISegmentKey getName() 
	{
		return enumName;
	}

	/**
	 * Sets Name of segment
	 * @param enumName enumeration showing segment name
	 */
	public void setName(ISegmentKey enumName) 
	{
		this.enumName = enumName;
	}

	/**
	 * Retrieves Segment Cardinality
	 * @return EnumSegmentCardinality - enumeration showing SegmentCardinality
	 */
	public EnumSegmentCardinality getSegmentCardinality() 
	{
		return enumSegmentCardinality;
	}

	/**
	 * Sets Segment Cardinality
	 * @param enumSegmentCardinality enumeration showing SegmentCardinality
	 */
	public void setSegmentCardinality(EnumSegmentCardinality enumSegmentCardinality) 
	{
		this.enumSegmentCardinality = enumSegmentCardinality;
	}

	/**
	 * Retrieves list of Group items
	 * @return IMap - return object of Imap
	 */
	public IMap getGroupItemMessageMap() 
	{
		return objGroupItemMessageMap;
	}

	/**
	 * Sets list of Group items
	 * @param objGroupItemMessageMap collection of group items
	 */
	public void setGroupItems(IMap objGroupItemMessageMap) 
	{
		this.objGroupItemMessageMap = objGroupItemMessageMap;
	}

	/**
	 * Defines whether it is a segment or a group
	 * @return boolean shows status as success or failure
	 */
	public boolean isGroup()
	{
		return isGroup;
	}

	/**
	 * Specifies item as group or segment
	 * @param isGroup shows status as success or failure
	 */
	public void setIsGroup(boolean isGroup) 
	{
		this.isGroup = isGroup;
	}
}