/* ****************************************************************************
*
* getSubscription -
*
* GET /v2/subscription/<id>
*
*/
std::string getSubscription
(
  ConnectionInfo*            ciP,
  int                        components,
  std::vector<std::string>&  compV,
  ParseData*                 parseDataP
)
{
  ngsiv2::Subscription sub;
  std::string          idSub = compV[2];
  OrionError           oe;
  std::string          out;
  std::string          err;

  if ((err = idCheck(idSub)) != "OK")
  {
    OrionError oe(SccBadRequest, err);
    return oe.render(ciP, "Invalid subscription ID");
  }

  TIMED_MONGO(mongoGetSubscription(&sub, &oe, idSub, ciP->uriParam, ciP->tenant));

  if (oe.code != SccOk)
  {
    TIMED_RENDER(out = oe.render(ciP, "Invalid subscription ID"));
    return out;
  }

  TIMED_RENDER(out = sub.toJson());
  return out;
}
/* ****************************************************************************
*
* SubscriptionId::check - 
*/
std::string SubscriptionId::check(RequestType requestType, Format format, std::string indent, std::string predetectedError, int counter)
{
  std::string out = "OK";

  if (string != "")
    out = idCheck(string);

  return out;
}
/* ****************************************************************************
*
* SubscriptionId::check -
*/
std::string SubscriptionId::check(void)
{
  std::string out = "OK";

  if (string != "")
  {
    out = idCheck(string);
  }

  return out;
}
/* ****************************************************************************
*
* RegistrationId::check -
*/
std::string RegistrationId::check
(
  RequestType         requestType,
  Format              format,
  const std::string&  indent,
  const std::string&  predetectedError,
  int                 counter
)
{
  std::string out = "OK";

  if (string != "")
  {
    out = idCheck(string);
  }

  return out;
}