/*******************************************************************************
 *  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.dicomsnomedmap.EnumDICOMSNOMEDMap;
import cdac.medinfo.sdk.dcm30_04.templates.enums.EnumCodingSchemeDesignator;
import cdac.medinfo.sdk.dcm30_04.templates.enums.EnumCodingSchemeVersion;
import cdac.medinfo.sdk.dcm30_04.templates.enums.cm.EnumCM_CTAndMRAnatomyImaged;
import cdac.medinfo.sdk.dcm30_04.templates.enums.cm.EnumCM_ChestComponentCategories;
import cdac.medinfo.sdk.dcm30_04.templates.enums.cm.EnumCM_CommonAnatomicRegions;
import cdac.medinfo.sdk.dcm30_04.templates.enums.cm.EnumCM_FunctionalConditionPresentDuringAcquisition;
import cdac.medinfo.sdk.dcm30_04.templates.enums.cm.EnumCM_HemodynamicPhysiologicalChallenges;
import cdac.medinfo.sdk.dcm30_04.templates.enums.cv.EnumCV_FunctionalConditionPresentDuringAcquisition;
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 FunctionalConditionPresentDuringAcquisition - CID3271
 */
public class FunctionalConditionPresentDuringAcquisition_CID91 {
	/**
	 * 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;

	/**
	 * The Coding Scheme Version
	 */
	private String strCodingSchemeVersion = null;

	/**
	 * Object of HemodynamicPhysiologicalChallenges_CID3271
	 */
	private HemodynamicPhysiologicalChallenges_CID3271 objHemodynamicPhysiologicalChallenges_CID3271;

	/**
	 * The SNOMED CT ID for template.
	 */
	private String strSNOMEDCTID = null;

	/**
	 * Instantiates a new FunctionalConditionPresentDuringAcquisition_CID3271
	 * Template.
	 */
	public FunctionalConditionPresentDuringAcquisition_CID91() {

	}

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

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

	/**
	 * Retrieves the value for CodingSchemeDesignator
	 * 
	 * @return strCodingSchemeDesignator String value for CodingSchemeDesignator
	 */
	public String getCodingSchemeDesignator() {
		return strCodingSchemeDesignator;
	}

	/**
	 * Retrieves the value for CodingSchemeVersion
	 * 
	 * @return
	 */
	public String getCodingSchemeVersion() {
		return strCodingSchemeVersion;
	}

	/**
	 * Retrieves the value for SNOMED-CT ID.
	 * 
	 * @return String value for SNOMED-CT ID.
	 */
	public String getSNOMEDCTID() {
		return strSNOMEDCTID;
	}

	/**
	 * Sets the Code Value according to Code Meaning.
	 * 
	 * @param enumFunctionalConditionPresentDuringAcquisition
	 *            Object of EnumCM_FunctionalConditionPresentDuringAcquisition
	 *            represents Code Meaning.
	 */
	private void setCodeValue(
			EnumCM_FunctionalConditionPresentDuringAcquisition enumFunctionalConditionPresentDuringAcquisition) {
		switch (enumFunctionalConditionPresentDuringAcquisition) {
		case PHONATION:
			this.strCodeValue = EnumCV_FunctionalConditionPresentDuringAcquisition.PHONATION_F_F7100
			.getValue();
			break;
		case WEIGHT_BEARING:
			this.strCodeValue = EnumCV_FunctionalConditionPresentDuringAcquisition.WEIGHT_BEARING_F_12300
			.getValue();
			break;
		case VOIDING:
			this.strCodeValue = EnumCV_FunctionalConditionPresentDuringAcquisition.VOIDING_F_72230
			.getValue();
			break;
		case PRIOR_TO_VOIDING:
			this.strCodeValue = EnumCV_FunctionalConditionPresentDuringAcquisition.PRIOR_TO_VOIDING_109134
			.getValue();
			break;
		case POST_VOIDING:
			this.strCodeValue = EnumCV_FunctionalConditionPresentDuringAcquisition.POST_VOIDING_109135
			.getValue();
			break;

		}
	}

	/**
	 * Sets the SNOMED-CT ID.
	 * 
	 * @param enumChestComponentCategories
	 *            Object of EnumCM_ChestComponentCategories represents Code
	 *            Meaning.
	 */
	private void setSNOMEDCTID(EnumCM_FunctionalConditionPresentDuringAcquisition enumFunctionalConditionPresentDuringAcquisition) {
		switch (enumFunctionalConditionPresentDuringAcquisition) {
		case PHONATION:
			this.strSNOMEDCTID = EnumDICOMSNOMEDMap.PHONATION.getSNOMEDCTID();
			break;
		case WEIGHT_BEARING:
			this.strSNOMEDCTID = EnumDICOMSNOMEDMap.WEIGHT_BEARING
			.getSNOMEDCTID();
			break;
		case VOIDING:
			this.strSNOMEDCTID = EnumDICOMSNOMEDMap.VOIDING.getSNOMEDCTID();
			break;
		
		}
	}

	/**
	 * Sets the value for FunctionalConditionPresentDuringAcquisition
	 * 
	 * @param enumFunctionalConditionPresentDuringAcquisition
	 *            Enum for FunctionalConditionPresentDuringAcquisition
	 */
	public void setFunctionalConditionPresentDuringAcquisition(Enum enumValue) 
	{


		if (enumValue instanceof EnumCM_FunctionalConditionPresentDuringAcquisition) 
		{
			EnumCM_FunctionalConditionPresentDuringAcquisition new_FunctionalConditionPresentDuringAcquisition = (EnumCM_FunctionalConditionPresentDuringAcquisition)enumValue;

			/**
			 * Retrieves the value for CodingSchemeDesignator, CodingSchemeVersion
			 * and Code Meaning and sets the Code Value according to Code Meaning.
			 */
			this.strCodeMeaning = new_FunctionalConditionPresentDuringAcquisition.getValue();

			if (strCodeMeaning.equalsIgnoreCase(EnumCM_FunctionalConditionPresentDuringAcquisition.PRIOR_TO_VOIDING.getValue())
					|| strCodeMeaning.equalsIgnoreCase(EnumCM_FunctionalConditionPresentDuringAcquisition.POST_VOIDING.getValue())) 
			{

				this.strCodingSchemeDesignator = EnumCodingSchemeDesignator.DCM.getValue();
			} else 
			{
				this.strCodingSchemeDesignator = EnumCodingSchemeDesignator.SRT.getValue();
			}

			/**
			 * set code Value
			 */
			setCodeValue(new_FunctionalConditionPresentDuringAcquisition);
			
			/**
			 * set SNOMED-CT ID
			 */
			setSNOMEDCTID(new_FunctionalConditionPresentDuringAcquisition
					);
		}
		else if(enumValue instanceof EnumCM_HemodynamicPhysiologicalChallenges)
		{
			/**
			 * Casting EnumValue to required Enum.
			 */
			EnumCM_HemodynamicPhysiologicalChallenges new_HemodynamicPhysiologicalChallenges = (EnumCM_HemodynamicPhysiologicalChallenges) enumValue;

			/**
			 * Creating object of require CID with respect to enum and setting value accordingly.
			 */
			if(null== this.objHemodynamicPhysiologicalChallenges_CID3271)
				this.objHemodynamicPhysiologicalChallenges_CID3271 = new HemodynamicPhysiologicalChallenges_CID3271();
			this.objHemodynamicPhysiologicalChallenges_CID3271.setHemodynamicPhysiologicalChallenges(new_HemodynamicPhysiologicalChallenges);

			/**
			 * Retrieving attributes and setting it to member variables. 
			 */
			this.strCodeMeaning = objHemodynamicPhysiologicalChallenges_CID3271.getCodeMeaning();
			this.strCodeValue = objHemodynamicPhysiologicalChallenges_CID3271.getCodeValue();
			this.strCodingSchemeDesignator = objHemodynamicPhysiologicalChallenges_CID3271.getCodingSchemeDesignator();
		}
		else
		{
			if(DicomConfig.createInstance().isLoggingOn())
			{
				DicomLogger objDicomLogger = DicomLogger.getLogger();
				objDicomLogger.log(ResourceBundleWrapper.getValue("warning","InvalidEnumeratedValue",new Locale(DicomConfig.createInstance().getLocale())));
			}
		}
	}
}

