/**
* Nudm_SDM
* Nudm Subscriber Data Management Service. � 2019, 3GPP Organizational Partners (ARIB, ATIS, CCSA, ETSI, TSDSI, TTA, TTC). All rights reserved. 
*
* The version of the OpenAPI document: 2.1.0.alpha-1
* 
*
* NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech).
* https://openapi-generator.tech
* Do not edit the class manually.
*/

#include "SessionManagementSubscriptionDataRetrievalApiImpl.h"
#include "SessionManagementSubscriptionData.h"
#include <nlohmann/json.hpp>

namespace oai {
namespace udm {
namespace api {

using namespace oai::udm::model;

SessionManagementSubscriptionDataRetrievalApiImpl::SessionManagementSubscriptionDataRetrievalApiImpl(std::shared_ptr<Pistache::Rest::Router> rtr)
    : SessionManagementSubscriptionDataRetrievalApi(rtr)
    { }

//void SessionManagementSubscriptionDataRetrievalApiImpl::get_sm_data(const std::string &supi, const Pistache::Optional<std::string> &supportedFeatures, const Pistache::Optional<Snssai> &singleNssai, const Pistache::Optional<std::string> &dnn, const Pistache::Optional<PlmnId> &plmnId, const Pistache::Optional<Pistache::Http::Header::Raw> &ifNoneMatch, const Pistache::Optional<Pistache::Http::Header::Raw> &ifModifiedSince, Pistache::Http::ResponseWriter &response) {
void SessionManagementSubscriptionDataRetrievalApiImpl::get_sm_data(const std::string &supi, const Pistache::Optional<Snssai> &singleNssai, const Pistache::Optional<std::string> &dnn, Pistache::Http::ResponseWriter &response) {

	std::cout <<"Received a SessionManagementSubscriptionDataRetrieval with supi " << supi.c_str()<<std::endl;
	/*
	 {
	   "singleNssai": {"sst":1, "sd":123},
	   "dnnConfigurations": {
	      "default":  {
	         "pduSessionTypes": {"defaultSessionType": "IPV4"} ,
	         "sscModes": {"defaultSscMode": "SSC_MODE_1"} ,
	         "5gQosProfile":  {"5qi": 12345, "arp": {"priorityLevel": 1 , "preemptCap": "NOT_PREEMPT" , "preemptVuln": "NOT_PREEMPTABLE"} },
	         "sessionAmbr": {"uplink": "10Mbps", "downlink":"11Mbps"}
	      }
	   }
	}
	 */
	nlohmann::json jsonData;
	jsonData["singleNssai"]["sst"] = 222;
	jsonData["singleNssai"]["sd"] = 123;
	jsonData["dnnConfigurations"]["carrier.com"]["pduSessionTypes"]["defaultSessionType"] = "IPV4";
	jsonData["dnnConfigurations"]["carrier.com"]["sscModes"]["defaultSscMode"] = "SSC_MODE_1";
	jsonData["dnnConfigurations"]["carrier.com"]["5gQosProfile"]["5qi"] = 60;
	jsonData["dnnConfigurations"]["carrier.com"]["5gQosProfile"]["arp"]["priorityLevel"] = 1;
	jsonData["dnnConfigurations"]["carrier.com"]["5gQosProfile"]["arp"]["preemptCap"] = "NOT_PREEMPT";
	jsonData["dnnConfigurations"]["carrier.com"]["5gQosProfile"]["arp"]["preemptVuln"] = "NOT_PREEMPTABLE";
	jsonData["dnnConfigurations"]["carrier.com"]["sessionAmbr"]["uplink"] = "10Mbps";
	jsonData["dnnConfigurations"]["carrier.com"]["sessionAmbr"]["downlink"] = "11Mbps";

/*
	SessionManagementSubscriptionData subscriptionData;
	subscriptionData.setSingleNssai(singleNssai.get());

	DnnConfiguration dnnConfiguration;
	PduSessionTypes pduSessionTypes;
    SscModes sscModes;
    SubscribedDefaultQos qosProfile;
    Ambr sessionAmbr;

    pduSessionTypes.setDefaultSessionType(PduSessionType(PduSessionType_e::PDU_SESSION_TYPE_E_IPV4));
	dnnConfiguration.setPduSessionTypes(pduSessionTypes);
	sscModes.setDefaultSscMode(SscMode(SscMode_e::SSC_MODE_1));
	dnnConfiguration.setSscModes(sscModes);
*/

	//Send reply to SMF
	std::string resBody = jsonData.dump();
	//httpResponse.headers().add<Pistache::Http::Header::Location>(url);
	response.send(Pistache::Http::Code::Ok, resBody);

}

}
}
}

