/**
 * Npcf_SMPolicyControl API
 * Session Management Policy Control Service © 2020, 3GPP Organizational
 * Partners (ARIB, ATIS, CCSA, ETSI, TSDSI, TTA, TTC). All rights reserved.
 *
 * The version of the OpenAPI document: 1.1.1.alpha-5
 *
 *
 * NOTE: This class is auto generated by OpenAPI Generator
 * (https://openapi-generator.tech). https://openapi-generator.tech Do not edit
 * the class manually.
 */

#include "SMPoliciesCollectionApiImpl.h"
#include "3gpp_29.500.h"
#include "logger.hpp"

namespace oai::pcf::api {

using namespace oai::model::pcf;
using namespace oai::pcf::app;
using namespace oai::pcf::app::sm_policy;
using namespace oai::model::common;

SMPoliciesCollectionApiImpl::SMPoliciesCollectionApiImpl(
    const std::shared_ptr<Pistache::Rest::Router>& rtr,
    const std::shared_ptr<pcf_smpc>& smpc_service, const std::string& address)
    : SMPoliciesCollectionApi(rtr) {
  m_api_handler = std::make_shared<sm_policies_collection_api_handler>(
      sm_policies_collection_api_handler(smpc_service, address));
}

void SMPoliciesCollectionApiImpl::create_sm_policy(
    const SmPolicyContextData& smPolicyContextData,
    Pistache::Http::ResponseWriter& response) {
  api_response api_resp = m_api_handler->create_sm_policy(smPolicyContextData);
  response.headers()    = api_resp.headers;

  response.send(Pistache::Http::Code(api_resp.status_code), api_resp.body);
}

}  // namespace oai::pcf::api