/*******************************************************************************
 *  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.enums.EnumMeasuredCharacteristics;
import cdac.medinfo.sdk.dcm30_04.enums.EnumMeasurementFunctions;
import cdac.medinfo.sdk.dcm30_04.utils.DicomConstants;
/**
* This item class contains the methods to set, get and validate the attribute present in Measurement EquipmentSequence.
 */


public class MeasurementEquipmentSequenceItem extends Item{
	

	/**
	 * 
	 */
	private static final long serialVersionUID = 1L;
	/**
	 * This constructor creates the item and internal code sequence macro with default TransferSyntax 
	 */
	MeasurementEquipmentSequenceItem()
	{
		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
	 */
	MeasurementEquipmentSequenceItem(ITransferSyntax objITransferSyntax)
	{
		super(objITransferSyntax);
	}

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

	/**
	 * Sets the Measurement Functions Defined in Terms of Enum
	 * Measurement functions of the measurement equipment.Enumerated Values:
	 * PHOTOMETER	measurement of light intensity
	 * COLORIMETER	measurement of energy along the visible spectrum
	 * ILLUMINOMETER	measurement of illumination (ambient luminance
	 * @param enumMeasurementFunctions Specifies type of the value encoded in this Item
	 */
	public void setMeasurementFunctions(EnumMeasurementFunctions enumMeasurementFunctions)
	{
		/* Accept the Value Type in Measurement Functions format of type CS.
		 * Measurement functions of the measurement equipment.Enumerated Values
		 * Add this element to the Data Set
		 */
		IDataElement objIDataElement = null;
		if(objITransferSyntax.getVRTransferSyntax() == DicomConstants.DCM_VR_IMPLICIT)
			objIDataElement = new ImplicitDE(0x0028, 0x7013, enumMeasurementFunctions,getDictionaryReader());
		else
			objIDataElement = new ExplicitDE(0x0028, 0x7013,DicomConstants.DCM_DT_CS, enumMeasurementFunctions);

		addDataElement(objIDataElement);
	}
	/**
	 * Retrieves type of the MeasurementFunctions encoded in this Item
	 * @return String - Type of the MeasurementFunctions encoded in this Item
	 */
	public String getMeasurementFunctions()
	{
		Object objValue = getValue(0x0028, 0x7013);
		if(objValue != null)
			return objValue.toString();
		return null;
	}

	/**
	 * Sets the Measured Characteristics Defined in Terms of Enum
	 * Characteristic(s) which are measured by the measurement equipment.Enumerated Values:
	 * UNIFORMITY	Luminance uniformity
	 * LUMINANCE	Luminance
	 * CHROMATICITY	Chromaticity
	 * ILLUMINANCE	Illuminance
	 * @param enumMeasuredCharacteristics Specifies type of the value encoded in this Item
	 */
	public void setMeasuredCharacteristics(EnumMeasuredCharacteristics enumMeasuredCharacteristics)
	{
		/* Accept the MeasuredCharacteristics in Enum.
		 * Characteristic(s) which are measured by the measurement equipment
		 * Add this element to the Data Set
		 */
		IDataElement objIDataElement = null;
		if(objITransferSyntax.getVRTransferSyntax() == DicomConstants.DCM_VR_IMPLICIT)
			objIDataElement = new ImplicitDE(0x0028, 0x7026, enumMeasuredCharacteristics,getDictionaryReader());
		else
			objIDataElement = new ExplicitDE(0x0028, 0x7026,DicomConstants.DCM_DT_CS, enumMeasuredCharacteristics);

		addDataElement(objIDataElement);
	}
	/**
	 * Retrieves type of the value encoded in this Item
	 * @return String - Type of the value encoded in this Item
	 */
	public String getMeasuredCharacteristics()
	{
		Object objValue = getValue(0x0028, 0x7026);
		if(objValue != null)
			return objValue.toString();
		return null;
	}

	/**
	 * Sets the MeasurementEquipmentType Defined in Terms of Type of measurement equipment.
	 * @param strMeasurementEquipmentType Specifies type of the value encoded in this Item
	 */
	public void setMeasurementEquipmentType(String strMeasurementEquipmentType)
	{
		/* Accept the MeasurementEquipmentType in String format of type CS.
		 * Type of measurement equipment.
		 * Add this element to the Data Set
		 */
		IDataElement objIDataElement = null;
		if(objITransferSyntax.getVRTransferSyntax() == DicomConstants.DCM_VR_IMPLICIT)
			objIDataElement = new ImplicitDE(0x0028, 0x7014, strMeasurementEquipmentType,getDictionaryReader());
		else
			objIDataElement = new ExplicitDE(0x0028, 0x7014,DicomConstants.DCM_DT_CS, strMeasurementEquipmentType);

		addDataElement(objIDataElement);
	}
	/**
	 * Retrieves type of the MeasurementEquipmentType encoded in this Item
	 * @return String - Type of the MeasurementEquipmentType encoded in this Item
	 */
	public String getMeasurementEquipmentType()
	{
		Object objValue = getValue(0x0028, 0x7014);
		if(objValue != null)
			return objValue.toString();
		return null;
	}
	
	/**
	 * Sets Manufacturer.
	 * Manufacturer of the measurement equipment.
	 * @param strManufacturer String value of Manufacturer.
	 */
	public void setManufacturer(String strManufacturer)
	{
		/* Accept the Manufacturer in String format of type LO.
		 * Manufacturer of the measurement equipment.
		 * Add this element to the Data Set
		 */
		IDataElement objIDataElement = null;
		if(objITransferSyntax.getVRTransferSyntax() == DicomConstants.DCM_VR_IMPLICIT)
			objIDataElement = new ImplicitDE(0x0008,0x0070, strManufacturer,getDictionaryReader());
		else
			objIDataElement = new ExplicitDE(0x0008,0x0070,DicomConstants.DCM_DT_LO, strManufacturer);

		addDataElement(objIDataElement);
	}

	/**
	 * Return user-defined label identifier for Manufacturer.
	 * @return String - value of Manufacturer.
	 */
	public String getManufacturer()
	{
		Object objValue = getValue(0x0008,0x0070);
		if(objValue != null)
			return objValue.toString();
		return null;
	}
	
	/**
	 * Sets ManufacturersModelName.
	 * ManufacturersModelName of the measurement equipment.
	 * @param strManufacturersModelName String value of ManufacturersModelName.
	 */
	public void setManufacturersModelName(String strManufacturersModelName)
	{
		/* Accept the Manufacturer in String format of type LO.
		 * ManufacturersModelName of the measurement equipment.
		 * Add this element to the Data Set
		 */
		IDataElement objIDataElement = null;
		if(objITransferSyntax.getVRTransferSyntax() == DicomConstants.DCM_VR_IMPLICIT)
			objIDataElement = new ImplicitDE(0x0008,0x1090, strManufacturersModelName,getDictionaryReader());
		else
			objIDataElement = new ExplicitDE(0x0008,0x1090,DicomConstants.DCM_DT_LO, strManufacturersModelName);

		addDataElement(objIDataElement);
	}

	/**
	 * Return user-defined label identifier for ManufacturersModelName.
	 * @return String - value of ManufacturersModelName.
	 */
	public String getManufacturersModelName()
	{
		Object objValue = getValue(0x0008,0x1090);
		if(objValue != null)
			return objValue.toString();
		return null;
	}

	/**
	 * Sets DeviceSerialNumber.
	 * DeviceSerialNumber of the Device Serial Number.
	 * @param strDeviceSerialNumber String value of DeviceSerialNumber.
	 */
	public void setDeviceSerialNumber(String strDeviceSerialNumber)
	{
		/* Accept the DeviceSerialNumber in String format of type LO.
		 * DeviceSerialNumber of the measurement equipment.
		 * Add this element to the Data Set
		 */
		IDataElement objIDataElement = null;
		if(objITransferSyntax.getVRTransferSyntax() == DicomConstants.DCM_VR_IMPLICIT)
			objIDataElement = new ImplicitDE(0x0018,0x1000, strDeviceSerialNumber,getDictionaryReader());
		else
			objIDataElement = new ExplicitDE(0x0018,0x1000,DicomConstants.DCM_DT_LO, strDeviceSerialNumber);

		addDataElement(objIDataElement);
	}

	/**
	 * Return user-defined label identifier for DeviceSerialNumber.
	 * @return String - value of DeviceSerialNumber.
	 */
	public String getDeviceSerialNumber()
	{
		Object objValue = getValue(0x0018,0x1000);
		if(objValue != null)
			return objValue.toString();
		return null;
	}
	
	/**
	 * Sets Date and Time of the last calibration of the measurement equipment.
	 * @param strDateTimeofLastCalibration String value of Verification DateTime
	 */
	public void setDateTimeofLastCalibration(String strDateTimeofLastCalibration)
	{
		/* Accept the Date Time of Last Calibration of type DT.
		 * Date and time of the last calibration of the measurement equipment.
		 * Add this element to the Data Set
		 */
		IDataElement objIDataElement = null;
		if(objITransferSyntax.getVRTransferSyntax() == DicomConstants.DCM_VR_IMPLICIT)
			objIDataElement = new ImplicitDE(0x0018,0x1202,strDateTimeofLastCalibration,getDictionaryReader());
		else
			objIDataElement = new ExplicitDE(0x0018,0x1202,DicomConstants.DCM_DT_DT, strDateTimeofLastCalibration);

		addDataElement(objIDataElement);
	}

	/**
	 * Retrieves Verification DateTime
	 * @return String - value of Verification DateTime
	 */
	public String getDateTimeofLastCalibration()
	{
		Object objValue = getValue(0x0018,0x1202);
		if(objValue != null)
			return objValue.toString();
		return null;
	}

}
