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

import java.util.Locale;

import cdac.medinfo.sdk.dcm30_04.templates.dicomsnomedmap.BreastGYNMammoSNOMEDMap;
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_MammographySingleImageFinding;
import cdac.medinfo.sdk.dcm30_04.templates.enums.cm.EnumCM_SingleImageFindingFromBI_RADS;
import cdac.medinfo.sdk.dcm30_04.templates.enums.cv.EnumCV_MammographySingleImageFinding;
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 MammographySingleImageFinding - CID6014
 */
public class MammographySingleImageFinding_CID6014 
{
	
	/**
	 * The Code Value for template.
	 */
	private String strCodeValue = null;
	/**
	 * The SNOMED CT ID for template.
	 */
	private String strSNOMEDCTID = null;
	
	/**
	 * Retrieves the value for SNOMED-CT ID.
	 * @return String value for SNOMED-CT ID.
	 */
	public String getSNOMEDCTID() 
	{
		return strSNOMEDCTID;
	}
	/**
	 * The Code Meaning for template.
	 */
	private String strCodeMeaning = null;

	/**
	 * The Coding Scheme Designator for template.
	 */
	private String strCodingSchemeDesignator;

	/**
	 * The Coding Scheme Version for template.
	 */
	private String strCodingSchemeVersion;
	
	/**
	 * Object of VascularComplications_CID3754
	 */
	private SingleImageFindingFromBI_RADS_CID6015 objFindingFromBIRADSCID6015;
	

	/**
	 * 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;
	}
	
	/**
	 * Retrieves the value for Coding Scheme Version
	 * @return String value for Coding Scheme Version
	 */
	public String getCodingSchemeVersion() 
	{
		return strCodingSchemeVersion;
	}

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

	}

	/**
	 * Sets the Code Value according to Code Meaning.
	 * @param enumMammographySingleImageFinding Object of EnumCM_MammographySingleImageFinding represents Code Meaning.
	 */
	private void setCodeValue(EnumCM_MammographySingleImageFinding enumMammographySingleImageFinding)
	{
		switch(enumMammographySingleImageFinding)
		{
		case SELECTED_REGION: this.strCodeValue = EnumCV_MammographySingleImageFinding.SELECTED_REGION_111099.getValue();break;
		case BREAST_GEOMETRY: this.strCodeValue = EnumCV_MammographySingleImageFinding.BREAST_GEOMETRY_111100.getValue();break;
		case IMAGE_QUALITY: this.strCodeValue = EnumCV_MammographySingleImageFinding.IMAGE_QUALITY_111101.getValue();break;
		case NON_LESION: this.strCodeValue = EnumCV_MammographySingleImageFinding.NON_LESION_111102.getValue();break;
		case NIPPLE: this.strCodeValue = EnumCV_MammographySingleImageFinding.NIPPLE_T_04100.getValue();break;
		}
	}
	/**
	 * Sets the SNOMED-CT ID.
	 * @param enumMammographySingleImageFinding Object of EnumCM_MammographySingleImageFinding represents Code Meaning.
	 */
	private void setSNOMEDCTID(EnumCM_MammographySingleImageFinding enumMammographySingleImageFinding)
	{
		switch(enumMammographySingleImageFinding)
		{
		case NIPPLE : this.strSNOMEDCTID =BreastGYNMammoSNOMEDMap.NIPPLE.getSNOMEDCTID(); break;
		}
	}
	/**
	 * Sets the value for MammographySingleImageFinding
	 * @param enumValue This Enum value can be one of the following enums - EnumCM_MammographySingleImageFinding, EnumCM_SingleImageFindingFromBI_RADS.
	 */
	public void setMammographySingleImageFinding(Enum enumValue)
	{
		if (enumValue instanceof EnumCM_MammographySingleImageFinding) 
		{
			/**
			 * Casting EnumValue to required Enum.
			 */
			EnumCM_MammographySingleImageFinding new_enumMammographySingleImageFinding = (EnumCM_MammographySingleImageFinding)enumValue;
			
			this.strCodeMeaning = new_enumMammographySingleImageFinding.getValue();
			if(new_enumMammographySingleImageFinding.getValue().equalsIgnoreCase(EnumCM_MammographySingleImageFinding.NIPPLE.getValue()))
			{
				this.strCodingSchemeDesignator = EnumCodingSchemeDesignator.SRT.getValue();
			}
			else
			{
				this.strCodingSchemeDesignator = EnumCodingSchemeDesignator.DCM.getValue();
			}
			this.strCodingSchemeVersion = EnumCodingSchemeVersion.NO_VALUE.getValue();
			
			setCodeValue(new_enumMammographySingleImageFinding);
			setSNOMEDCTID(new_enumMammographySingleImageFinding);
		}
		else if(enumValue instanceof EnumCM_SingleImageFindingFromBI_RADS)
		{
			/**
			 * Casting EnumValue to required Enum.
			 */
			EnumCM_SingleImageFindingFromBI_RADS new_enumSingleImageFindingFromBI_RADS = (EnumCM_SingleImageFindingFromBI_RADS) enumValue;
			
			/**
			 * Creating object of require CID with respect to enum and setting value accordingly.
			 */
			if(null== this.objFindingFromBIRADSCID6015)
	this.objFindingFromBIRADSCID6015 = new SingleImageFindingFromBI_RADS_CID6015();
			this.objFindingFromBIRADSCID6015.setSingleImageFindingFromBI_RADS(new_enumSingleImageFindingFromBI_RADS);
			
			/**
			 * Retrieving attributes and setting it to member variables. 
			 */
			this.strCodeMeaning = objFindingFromBIRADSCID6015.getCodeMeaning();
			this.strCodeValue = objFindingFromBIRADSCID6015.getCodeValue();
			this.strCodingSchemeDesignator = objFindingFromBIRADSCID6015.getCodingSchemeDesignator();
			this.strCodingSchemeVersion = objFindingFromBIRADSCID6015.getCodingSchemeVersion();
			this.strSNOMEDCTID = objFindingFromBIRADSCID6015.getSNOMEDCTID();
		}
		else
		{
			if(DicomConfig.createInstance().isLoggingOn())
			{
				DicomLogger objDicomLogger = DicomLogger.getLogger();
				objDicomLogger.log(ResourceBundleWrapper.getValue("warning","InvalidEnumeratedValue",new Locale(DicomConfig.createInstance().getLocale())));
			}
		}
	}
}
