/*******************************************************************************
 *  Copyright 2017-2018 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.dcm30_04.baselibs;

import cdac.medinfo.sdk.dcm30_04.commoninterface.IDataElement;
import cdac.medinfo.sdk.dcm30_04.commoninterface.IDictionaryReader;
import cdac.medinfo.sdk.dcm30_04.commoninterface.ITransferSyntax;
import cdac.medinfo.sdk.dcm30_04.utils.DicomConstants;
/**
* This item class contains the methods to set, get and validate the attribute present in Display Subsystem Configuration Sequence .
 */


public class DisplaySubsystemConfigurationSequenceItem extends Item
{
	

	private static final long serialVersionUID = 1L;
	/**
	 * This constructor creates the item and internal code sequence macro with default TransferSyntax 
	 */
	DisplaySubsystemConfigurationSequenceItem()
	{
		super();
	}


	/**
	 * This constructor creates the item and internal code sequence macro with specified TransferSyntax 
	 * and default DictionaryReader
	 * @param objITransferSyntax specifies the DICOM Standard defined TransfeSyntax
	 */
	DisplaySubsystemConfigurationSequenceItem(ITransferSyntax objITransferSyntax)
	{
		super(objITransferSyntax);
	}

	/**
	 * This constructor creates DisplaySubsystemConfigurationSequenceItem with specified TransferSyntax and
	 * specified DictionaryReader
	 * @param objTransferSyntax specifies the DICOM Standard defined TransfeSyntax
	 * @param objDictionaryReader specifies the DICOM Dictionary reader to be used 
	 */
	DisplaySubsystemConfigurationSequenceItem(ITransferSyntax objTransferSyntax, IDictionaryReader objDictionaryReader)
	{
		super(objTransferSyntax,objDictionaryReader);
	}

	/**
	 * Sets Number of significant bits within the waveform samples
	 * @param shConfigurationID short value of Number of significant bits
	 */
	public void setConfigurationID(short shConfigurationID)
	{
		/* Accept the ConfigurationID of type US.
		 * Number that identifies a specific display subsystem configuration within the Display Subsystem Configuration Sequence (0028,700A).
		 * Add this element to the Data Set
		 */
		IDataElement objIDataElement = null;
		if(objITransferSyntax.getVRTransferSyntax() == DicomConstants.DCM_VR_IMPLICIT)	
			objIDataElement = new ImplicitDE(0x0028,0x700B,shConfigurationID,getDictionaryReader());
		else
			objIDataElement = new ExplicitDE(0x0028,0x700B,DicomConstants.DCM_DT_US, shConfigurationID);

		addDataElement(objIDataElement);
	}

	/**
	 * Retrieves ConfigurationID.Number that identifies a specific display subsystem configuration within the Display Subsystem Configuration Sequence (0028,700A).
	 * @return short - short value of Number of significant bits
	 */
	public short getConfigurationID()
	{
		Object objValue = getValue(0x0028,0x700B);
		if(objValue != null)
			return Short.parseShort(objValue.toString());
		return DicomConstants.DCM_NO_VALUE;
	}

	/**
	 * Sets the ConfigurationName.
	 * @param strConfigurationName
	 */
	public void setConfigurationName(String strConfigurationName)
	{
		/* Accept the ConfigurationName in String format of type SH.
		 * User-defined name for the Display Subsystem Configuration
		 * Add this element to the Data Set
		 */
		IDataElement objIDataElement = null;
		if(objITransferSyntax.getVRTransferSyntax() == DicomConstants.DCM_VR_IMPLICIT)
			objIDataElement = new ImplicitDE(0x0028,0x700C, strConfigurationName,objIDictionaryReader);
		else
			objIDataElement = new ExplicitDE(0x0028,0x700C,DicomConstants.DCM_DT_SH, strConfigurationName);
		addDataElement(objIDataElement);
	}
	/**
	 * Retrieves User-defined name for the Display Subsystem Configuration.
	 * @return String - value of Configuration Name.
	 */
	public String getConfigurationName()
	{
		Object objValue = getValue(0x0028,0x700C);
		if(objValue != null)
			return objValue.toString();
		return null;
	}
	
	/**
	 * Sets ConfigurationDescription.
	 * @param strConfigurationDescription String value of Configuration Description.
	 */
	public void setRescaleType(String strConfigurationDescription)
	{
		/* Accept the Configuration Description in String format of type LO.
		 * A free text description of the Display Subsystem Configuration
		 * Add this element to the Data Set
		 */
		IDataElement objIDataElement = null;
		if(objITransferSyntax.getVRTransferSyntax() == DicomConstants.DCM_VR_IMPLICIT)
			objIDataElement = new ImplicitDE(0x0028,0x700D, strConfigurationDescription,getDictionaryReader());
		else
			objIDataElement = new ExplicitDE(0x0028,0x700D,DicomConstants.DCM_DT_LO, strConfigurationDescription);

		addDataElement(objIDataElement);
	}

	/**
	 * Return A free text description of the Display Subsystem Configuration
	 * @return String - value of Configuration Description.
	 */
	public String getConfigurationDescription()
	{
		Object objValue = getValue(0x0028,0x700D);
		if(objValue != null)
			return objValue.toString();
		return null;
	}
	/**
	 * Sets Referenced Target Luminance Characteristics ID
	 * @param shReferencedTargetLuminanceCharacteristicsID short value of Number of significant bits
	 */
	public void setReferencedTargetLuminanceCharacteristicsID(short shReferencedTargetLuminanceCharacteristicsID)
	{
		/* Accept the ReferencedTargetLuminanceCharacteristicsID of type US.
		 * References the intended luminance characteristics for this Configuration of this Display Subsystem.
		 * Add this element to the Data Set
		 */
		IDataElement objIDataElement = null;
		if(objITransferSyntax.getVRTransferSyntax() == DicomConstants.DCM_VR_IMPLICIT)	
			objIDataElement = new ImplicitDE(0x0028,0x700E,shReferencedTargetLuminanceCharacteristicsID,getDictionaryReader());
		else
			objIDataElement = new ExplicitDE(0x0028,0x700E,DicomConstants.DCM_DT_US, shReferencedTargetLuminanceCharacteristicsID);

		addDataElement(objIDataElement);
	}

	/**
	 * Retrieves ReferencedTargetLuminanceCharacteristicsID
	 * References the intended luminance characteristics for this Configuration of this Display Subsystem.
	 * @return short - short value of Number of significant bits
	 */
	public short getReferencedTargetLuminanceCharacteristicsID()
	{
		Object objValue = getValue(0x0028,0x700E);
		if(objValue != null)
			return Short.parseShort(objValue.toString());
		return DicomConstants.DCM_NO_VALUE;
	}
}
