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

import cdac.medinfo.sdk.hl7282.commoninterface.ISingleCollection;

/**
 * ISegmentMap needs to be implemented by class which provides Data Structure for a segment structure.
 * Implementor class should provide definition to all methods which are defined to represent segment structure.
 */
public interface ISegmentMap 
{
	/**
	 * Retrieves Attribute structure in terms of AttributeItem from specified sequence.
	 * @param index sequence value for attribute.
	 * @return IAttributeItem instance of AttributeItem
	 */
	IAttributeItem getAttributeItem(int index);
	
	/**
	 * Adds AttributeItem to ISegmentMap at current available index.
	 * @param objAttributeItem instance of Attribute Item
	 */
	void addAttributeItem(IAttributeItem objAttributeItem);
	
	/**
	 * Adds AttributeItem to ISegmentMap at given index position according to the modification mode.
	 * @param objAttributeItem instance of Attribute Item
	 * @param index sequence position
	 * @param enumModifyMode enumerated value of modification mode
	 */
	void addAttributeItem(IAttributeItem objAttributeItem,int index,EnumMapModifyMode enumModifyMode);
	
	/**
	 * Retrieves a clone of ISegmentMap
	 * @return ISegmentMap - instance of ISegmentMap
	 */
	ISegmentMap clone();
	
	/**
	 * Sets lock on ISegmentMap.
	 * If lock is set then new AttributeItem can not be added in SegmentMap
	 * @param bLock value of lock
	 */
	void setLock(boolean bLock);
	
	/**
	 * Retrieves current status of lock for ISegmentMap
	 * @return boolean - status of lock
	 */
	boolean getLock();
	
	/**
	 * Retrieves size of ISegmentMap
	 * @return int - total number of Attribute Items
	 */
	int size();
	
	/**
	 * Retrieves the list of Item ID of all AttributeItems which are member of ISEgmentMap.
	 * @return ISingleCollection<Integer> - return collection of Item ID.
	 */
	ISingleCollection<Integer> getItemIDList();

	/**
	 * Retrieves the Table value specified by HL7 Standard for the specified Item ID.
	 * @param iItemID Integer value of Item ID.
	 * @return int[] - return array of Table value for specified Item ID.
	 */
	int[] getValueTable(int iItemID);

	/**
	 * Retrieves the Minimum Length of an Item specified by HL7 Standard for the specified Item.
	 * @param iItemID Integer value of Item ID.
	 * @return int - return Minimum Length value for specified Item ID.
	 */
	int getItemMinimumLength(int iItemID);

	/**
	 * Retrieves the Maximum Length of an Item specified by HL7 Standard for the specified Item.
	 * @param iItemID Integer value of Item ID.
	 * @return int - return Maximum Length value for specified Item ID.
	 */
	int getItemMaximumLength(int iItemID);
	
	/**
	 * Retrieves the Conformance Length of an Item specified by HL7 Standard for the specified Item.
	 * @param iItemID Integer value of Item ID.
	 * @return String - return Conformance Length value for specified Item ID.
	 */
	public String getItemConformanceLength(int iItemID);
	
	/**
	 * Retrieves the Data Type name of an Item specified by HL7 Standard for the specified Item.
	 * @param iItemID Integer value of Item ID.
	 * @return String - return Data type name for specified Item ID.
	 */
	String getDataTypeName(int iItemID);

	/**
	 * Retrieves the status indicating whether the specified Item ID is repeatable or not. 
	 * @param iItemID Integer value of Item ID.
	 * @return boolean - the status indicating whether the specified Item ID is repeatable or not.
	 */
	boolean isRepeatable(int iItemID);
	
	/**
	 * Retrieves Occurrence for attribute defined by HL7 standard in segment
	 * @param iItemID Integer value of Item ID.
	 * @return int - Number of Occurence of the attribute
	 */
	int getOccurrence(int iItemID);

	/**
	 * Retrieves the status indicating whether the specified Item ID is optional or not.
	 * @param iItemID Integer value of Item ID.
	 * @return boolean - the status indicating whether the specified Item ID is optional or not.
	 */
	boolean isOptional(int iItemID);

	/**
	 * Retrieves the Field name of an Item specified by HL7 Standard for the specified Item.
	 * @param iItemID Integer value of Item ID.
	 * @return String - return Field name for specified Item ID.
	 */
	String getFieldName(int iItemID);
	
	/**
	 * Retrieves the Sequence number of an Item specified by HL7 Standard for the specified Item.
	 * @param iItemID Integer value of Item ID.
	 * @return int - return Sequence number for specified Item ID.
	 */
	int getSequenceNo(int iItemID);
}
