/*******************************************************************************
 *  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.dicommodel.modules;



import cdac.medinfo.sdk.dcm30_04.baselibs.Tag;
import cdac.medinfo.sdk.dcm30_04.commoninterface.IDataSet;
import cdac.medinfo.sdk.dcm30_04.commoninterface.ITag;
import cdac.medinfo.sdk.dcm30_04.utils.DicomConstants;
import cdac.medinfo.sdk.dcm30_04.utils.ISingleCollection;
import cdac.medinfo.sdk.dcm30_04.utils.SingleCollection;

// TODO: Auto-generated Javadoc
/**
 \* This module defines the Attributes relevant to the scheduling of a patient visit.
 */
public class VisitSchedulingModule extends Module  
{

 
 /**
  * The obj single collection.
  */
 public static ISingleCollection<ITag> objSingleCollection = null;
	 

	/**
	 * Instantiates a new visit scheduling module.
	 * 
	 * @param objIDataSet the obj i data set
	 */
	public VisitSchedulingModule(IDataSet objIDataSet)
	{
		super(objIDataSet);
	}

	static
	{
		objSingleCollection = new SingleCollection<ITag>();
		objSingleCollection.add(new Tag(0x0038,0x001A));
		objSingleCollection.add(new Tag(0x0038,0x001B));
		objSingleCollection.add(new Tag(0x0038,0x001C));
		objSingleCollection.add(new Tag(0x0038,0x001D));
		objSingleCollection.add(new Tag(0x0038,0x001E));
	}

	/* (non-Javadoc)
	 * @see cdac.medinfo.sdk.dcm30_04.dicommodel.modules.Module#validateModule()
	 */
	public boolean validateModule()
	{
		return true;
	}

	/**
	 * Sets Date patient visit is scheduled to end.
	 * 
	 * @param strScheduledDischargeDate String value of Scheduled Discharge Date.
	 */
	public void setScheduledDischargeDate(String strScheduledDischargeDate)
	{
		/*Accept Scheduled Discharge Date in String format of type DA.
		 * Read the Transfer Syntax and check if ImplicitDE or ExplicitDE to create.
		 * Set the iGroupNumber and iElementNumber to ImplicitDE object 
		 * Set the iVRType
		 * Set length from the element
		 * Add this element to the Hash Map
		 */
		addDataElement(0x0038,0x001C, DicomConstants.DCM_DT_DA, strScheduledDischargeDate);
	}

	/**
	 * Sets Date patient visit is scheduled to start.
	 * 
	 * @param strScheduledAdmissionDate String value of Scheduled Admission Date
	 */
	public void setScheduledAdmissionDate(String strScheduledAdmissionDate)
	{
		/*Accept Scheduled Admission Date in String format of type DA.
		 * Read the Transfer Syntax and check if ImplicitDE or ExplicitDE to create.
		 * Set the iGroupNumber and iElementNumber to ImplicitDE object 
		 * Set the iVRType
		 * Set length from the element
		 * Add this element to the Hash Map
		 */
		addDataElement(0x0038,0x001A, DicomConstants.DCM_DT_DA, strScheduledAdmissionDate);
	}

	/**
	 * Sets Time patient visit is scheduled to start.
	 * 
	 * @param strAdmissionTime String value of Scheduled Admission Time
	 */
	public void setScheduledAdmissionTime(String strAdmissionTime)
	{
		/*Accept Admission Time in String format of type TM.
		 * Read the Transfer Syntax and check if ImplicitDE or ExplicitDE to create.
		 * Set the iGroupNumber and iElementNumber to ImplicitDE object 
		 * Set the iVRType
		 * Set length from the element
		 * Add this element to the Hash Map
		 */
		addDataElement(0x0038,0x001B, DicomConstants.DCM_DT_TM, strAdmissionTime);
	}

	/**
	 * Sets Time patient visit is scheduled to end.
	 * 
	 * @param strDischargeTime String value of Scheduled Discharge Time.
	 */
	public void setScheduledDischargeTime(String strDischargeTime)
	{
		/*Accept Discharge Time in String format of type TM.
		 * Read the Transfer Syntax and check if ImplicitDE or ExplicitDE to create.
		 * Set the iGroupNumber and iElementNumber to ImplicitDE object 
		 * Set the iVRType
		 * Set length from the element
		 * Add this element to the Hash Map
		 */
		addDataElement(0x0038,0x001D, DicomConstants.DCM_DT_TM, strDischargeTime);
	}

	/**
	 * Scheduled location where patient is to reside (ward,floor, room, etc. or outpatient)
	 * 
	 * @param strScheduledPatientInstitutionResidence String value of Scheduled Patient Institution Residence.
	 */
	public void setScheduledPatientInstitutionResidence(String strScheduledPatientInstitutionResidence)
	{
		/*Accept Scheduled Patient Institution Residence in String format of type TM.
		 * Read the Transfer Syntax and check if ImplicitDE or ExplicitDE to create.
		 * Set the iGroupNumber and iElementNumber to ImplicitDE object 
		 * Set the iVRType
		 * Set length from the element
		 * Add this element to the Hash Map
		 */
		addDataElement(0x0038,0x001E, DicomConstants.DCM_DT_LO, strScheduledPatientInstitutionResidence);
	}

	/**
	 * Retrieves Date patient visit is scheduled to end.
	 * 
	 * @return String - String value of Scheduled Discharge Date
	 */
	public String getScheduledDischargeDate()
	{
		 Object objValue = getValue(0x0038,0x001C);
   if(objValue!=null)
      return objValue.toString();
   return null;

	}

	/**
	 * Retrieves Date patient visit is scheduled to start.
	 * 
	 * @return String - String value of Scheduled Admission Date
	 */
	public String getScheduledAdmissionDate()
	{
		 Object objValue = getValue(0x0038,0x001A);
   if(objValue!=null)
      return objValue.toString();
   return null;

	}

	/**
	 * Retrieves Time patient visit is scheduled to start.
	 * 
	 * @return String - String value of Scheduled Admission Time
	 */
	public String getScheduledAdmissionTime()
	{
		 Object objValue = getValue(0x0038,0x001B);
   if(objValue!=null)
      return objValue.toString();
   return null;

	}

	/**
	 * Retrieves Time patient visit is scheduled to end.
	 * 
	 * @return String - String value of Scheduled Discharge Time
	 */
	public String getScheduledDischargeTime()
	{
		 Object objValue = getValue(0x0038,0x001D);
   if(objValue!=null)
      return objValue.toString();
   return null;

	}

	/**
	 * Retrieves Scheduled location where patient is to reside (ward, floor, room, etc. or outpatient)
	 * 
	 * @return String - String value of Scheduled Patient Institution Residence
	 */
	public String getScheduledPatientInstitutionResidence()
	{
		 Object objValue = getValue(0x0038,0x001E);
   if(objValue!=null)
      return objValue.toString();
   return null;

	}

	/* 
	 * I have modified the collection type from vector to custom class
	 * This method is used by the Module Iterator to iterate through the DataSet and return only
	 * those elements that belong to the respective Module class whose getVectorOfKeys is called.
	 */
	/**
	 * This method returns the vector of keys representing the DataElements
	 * that belong to this module.
	 * 
	 * @return vector of Tags - returns the vector containing the collection of tags
	 */
	public ISingleCollection<ITag> getVectorOfKeys()
	{
		return objSingleCollection;
	}
}
