#include "UserLocationInformationNR.hpp"

#include <iostream>
using namespace std;

namespace ngap{
	UserLocationInformationNR::UserLocationInformationNR()
	{
		nR_CGI = NULL;
		tAI = NULL;
		/*istimeStampSet = false;
		timeStamp = NULL;*/
	}
	UserLocationInformationNR::~UserLocationInformationNR(){}
	
	void UserLocationInformationNR::setInformationNR(NR_CGI* m_nR_CGI,TAI* m_tAI)
	{
		nR_CGI = m_nR_CGI;
		tAI = m_tAI;
	}
	/*void UserLocationInformationEUTRA::setInformationEUTRA(EUTRA_CGI* m_eUTRA_CGI,TAI* m_tAI,TimeStamp* m_timeStamp)
	{
		eUTRA_CGI = m_eUTRA_CGI;
		tAI = m_tAI;
		istimeStampSet = true;
		timeStamp = m_timeStamp;
	}*/
	bool UserLocationInformationNR::encode2UserLocationInformationNR(Ngap_UserLocationInformationNR_t *userLocationInformationNR)
	{
		if(!nR_CGI->encode2NR_CGI(&userLocationInformationNR->nR_CGI))
		{
			cout<<"[Warning] nR_CGI->encode2NR_CGI() error!"<<endl;
			return false;
		}
		if(!tAI->encode2TAI(&userLocationInformationNR->tAI))
		{
			cout<<"[Warning] tAI->encode2TAI() error!"<<endl;
			return false;
		}
		#if 0
		if(istimeStampSet)
		{
			Ngap_TimeStamp_t *ieTimeStamp = (Ngap_TimeStamp_t *)calloc(1,sizeof(Ngap_TimeStamp_t));
			if(!timeStamp->encodefromTimeStamp(ieTimeStamp))
			{
				cout<<"[Warning] timeStamp->encodefromTimeStamp() error!"<<endl;
				free(ieTimeStamp);
				return false;
			}
			userLocationInformationEUTRA->timeStamp = ieTimeStamp;
		}
		#endif
		return true;
	}
	bool UserLocationInformationNR::decodefromUserLocationInformationNR(Ngap_UserLocationInformationNR_t *userLocationInformationNR)
	{
		nR_CGI = new NR_CGI();
		if(!nR_CGI->decodefromNR_CGI(&userLocationInformationNR->nR_CGI))
		{
			cout<<"[Warning] nR_CGI->decodefromNR_CGI() error!"<<endl;
			return false;
		}
		tAI = new TAI();
		if(!tAI->decodefromTAI(&userLocationInformationNR->tAI))
		{
			cout<<"[Warning] tAI->decodefromTAI() error!"<<endl;
			return false;
		}
		#if 0
		if(userLocationInformationEUTRA->timeStamp)
		{
			istimeStampSet = true;
			timeStamp = new TimeStamp();
			if(!timeStamp->decodefromTimeStamp(userLocationInformationEUTRA->timeStamp))
			{
				cout<<"[Warning] timeStamp->decodefromTimeStamp() error!"<<endl;
				return false;
			}
		}
		#endif
		return true;
	}
	/*bool UserLocationInformationEUTRA::getTimeStampPresence()
	{
		return istimeStampSet;
	}*/
	/*void UserLocationInformationEUTRA::getInformationEUTRA(EUTRA_CGI* &m_eUTRA_CGI,TAI* &m_tAI,TimeStamp* &m_timeStamp)
	{
		m_eUTRA_CGI = eUTRA_CGI;
		m_tAI = tAI;
		m_timeStamp = timeStamp;
	}*/
	void UserLocationInformationNR::getInformationNR(NR_CGI* &m_nR_CGI,TAI* &m_tAI)
	{
		m_nR_CGI = nR_CGI;
		m_tAI = tAI;
	}
}

