/*******************************************************************************
 *  Copyright 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.templates.cid;


import java.util.Locale;

import cdac.medinfo.sdk.dcm30_04.templates.enums.EnumCodingSchemeDesignator;
import cdac.medinfo.sdk.dcm30_04.templates.enums.cm.EnumCM_AbstractMultiDimensionalImageModelDimensionUnits;
import cdac.medinfo.sdk.dcm30_04.templates.enums.cm.EnumCM_CTAndMRAnatomyImaged;
import cdac.medinfo.sdk.dcm30_04.templates.enums.cm.EnumCM_CommonAnatomicRegions;
import cdac.medinfo.sdk.dcm30_04.templates.enums.cm.EnumCM_UnitsOfLinearMeasurement;
import cdac.medinfo.sdk.dcm30_04.templates.enums.cv.EnumCV_AbstractMultiDimensionalImageModelDimensionUnits;
import cdac.medinfo.sdk.dcm30_04.utils.DicomConfig;
import cdac.medinfo.sdk.dcm30_04.utils.DicomLogger;
import cdac.medinfo.sdk.dcm30_04.utils.ResourceBundleWrapper;


/**
 * This class represents AbstractMultiDimensionalImageModelDimensionUnits - CID7183
 */
public class AbstractMultiDimensionalImageModelDimensionUnits_CID7183 
{
	
	/**
	 * The Code Value for template.
	 */
	private String strCodeValue = null;

	/**
	 * The Code Meaning for template.
	 */
	private String strCodeMeaning = null;

	/**
	 * The Coding Scheme Designator for template.
	 */
	private String strCodingSchemeDesignator;
	/**
	 * Object of UnitsOfLinearMeasurement_CID7460
	 */
	private UnitsOfLinearMeasurement_CID7460 objUnitsOfLinearMeasurementCID7460;

	/**
	 * Instantiates a new AbstractMultiDimensionalImageModelDimensionUnits_CID7183 Template 
	 */
	public AbstractMultiDimensionalImageModelDimensionUnits_CID7183()
	{

	}

	/**
	 * Retrieves the value for Code Meaning.
	 * @return String value for Code Meaning.
	 */
	public String getCodeMeaning()
	{
		return strCodeMeaning;
	}

	/**
	 * Retrieves the value for Code Value.
	 * @return String value for Code Value.
	 */
	public String getCodeValue() 
	{
		return strCodeValue;
	}

	/**
	 * Retrieves the value for Coding Scheme Designator.
	 * @return String value for Coding Scheme Designator.
	 */
	public String getCodingSchemeDesignator() 
	{
		return strCodingSchemeDesignator;
	}

	/**
	 * Sets the Code Value according to Code Meaning.
	 * @param enumAbstractMultiDimensionalImageModelDimensionUnits Object of EnumCM_AbstractMultiDimensionalImageModelDimensionUnits represents Code Meaning.
	 */
	private void setCodeValue(EnumCM_AbstractMultiDimensionalImageModelDimensionUnits enumAbstractMultiDimensionalImageModelDimensionUnits)
	{
		switch(enumAbstractMultiDimensionalImageModelDimensionUnits)
		{
		case MILLISECOND: this.strCodeValue =EnumCV_AbstractMultiDimensionalImageModelDimensionUnits.MILLISECOND_ms.getValue(); break;
		case SECOND: this.strCodeValue =EnumCV_AbstractMultiDimensionalImageModelDimensionUnits.SECOND_s.getValue(); break;
		case DEGREE: this.strCodeValue =EnumCV_AbstractMultiDimensionalImageModelDimensionUnits.DEGREE_deg.getValue(); break;
		case RADIAN: this.strCodeValue =EnumCV_AbstractMultiDimensionalImageModelDimensionUnits.RADIAN_rad.getValue(); break;
		}
	}

	/**
	 * Sets the value for AbstractMultiDimensionalImageModelDimensionUnits
	 * @param enumAbstractMultiDimensionalImageModelDimensionUnits Object of EnumCM_AbstractMultiDimensionalImageModelDimensionUnits.
	 */
	public void setAbstractMultiDimensionalImageModelDimensionUnits(Enum enumValue)
	{
		
		if (enumValue instanceof EnumCM_CTAndMRAnatomyImaged) 
		{
			/**
			 * Casting EnumValue to required Enum.
			 */
			EnumCM_AbstractMultiDimensionalImageModelDimensionUnits enumAbstractMultiDimensionalImageModelDimensionUnits = (EnumCM_AbstractMultiDimensionalImageModelDimensionUnits)enumValue;
			/**
			 * Retrieves the value for CodingSchemeDesignator, CodingSchemeVersion and Code Meaning and 
			 * sets the Code Value according to Code Meaning.
			 */
			this.strCodeMeaning = enumAbstractMultiDimensionalImageModelDimensionUnits.getValue();
			this.strCodingSchemeDesignator = EnumCodingSchemeDesignator.UCUM.getValue();
			
			/**
			 * set code Value
			 */
			setCodeValue(enumAbstractMultiDimensionalImageModelDimensionUnits);
			
		}
		else if(enumValue instanceof EnumCM_UnitsOfLinearMeasurement)
		{
			/**
			 * Casting EnumValue to required Enum.
			 */
			EnumCM_UnitsOfLinearMeasurement new_enumUnitsOfLinearMeasurement = (EnumCM_UnitsOfLinearMeasurement) enumValue;
			
			/**
			 * Creating object of require CID with respect to enum and setting value accordingly.
			 */
			if(null== this.objUnitsOfLinearMeasurementCID7460)
	this.objUnitsOfLinearMeasurementCID7460 = new UnitsOfLinearMeasurement_CID7460();
			this.objUnitsOfLinearMeasurementCID7460.setUnitsOfLinearMeasurement(new_enumUnitsOfLinearMeasurement);
			
			/**
			 * Retrieving attributes and setting it to member variables. 
			 */
			this.strCodeMeaning = objUnitsOfLinearMeasurementCID7460.getCodeMeaning();
			this.strCodeValue = objUnitsOfLinearMeasurementCID7460.getCodeValue();
			this.strCodingSchemeDesignator = objUnitsOfLinearMeasurementCID7460.getCodingSchemeDesignator();
		}
		else
		{
			if(DicomConfig.createInstance().isLoggingOn())
			{
				DicomLogger objDicomLogger = DicomLogger.getLogger();
				objDicomLogger.log(ResourceBundleWrapper.getValue("warning","InvalidEnumeratedValue",new Locale(DicomConfig.createInstance().getLocale())));
			}
		}
	}
}
