text: /**
   * PowerMeter API
   * API
   *
   * The version of the OpenAPI document: 2021.4.1
   *
   * NOTE: This class is auto generated by OpenAPI-Generator 4.3.1.
   * https://openapi-generator.tech
   * Do not edit the class manually.
   */
  
  
  
  #include "PinState.h"
  
  namespace powermeter {
  namespace model {
  
  
  
  
  PinState::PinState()
  {
      m_Pin = utility::conversions::to_string_t("");
      m_PinIsSet = false;
      m_State = utility::conversions::to_string_t("");
      m_StateIsSet = false;
      m_Fall_ramp = 0.0;
      m_Fall_rampIsSet = false;
      m_Fall_cap = 0.0;
      m_Fall_capIsSet = false;
      m_Rise_ramp = 0.0;
      m_Rise_rampIsSet = false;
      m_Rise_cap = 0.0;
      m_Rise_capIsSet = false;
  }
  
  PinState::~PinState()
  {
  }
  
  void PinState::validate()
  {
      // TODO: implement validation
  }
  
  web::json::value PinState::toJson() const
  {
  
      web::json::value val = web::json::value::object();
      
      if(m_PinIsSet)
      {
          val[utility::conversions::to_string_t("pin")] = ModelBase::toJson(m_Pin);
      }
      if(m_StateIsSet)
      {
          val[utility::conversions::to_string_t("state")] = ModelBase::toJson(m_State);
      }
      if(m_Fall_rampIsSet)
      {
          val[utility::conversions::to_string_t("fall_ramp")] = ModelBase::toJson(m_Fall_ramp);
      }
      if(m_Fall_capIsSet)
      {
          val[utility::conversions::to_string_t("fall_cap")] = ModelBase::toJson(m_Fall_cap);
      }
      if(m_Rise_rampIsSet)
      {
          val[utility::conversions::to_string_t("rise_ramp")] = ModelBase::toJson(m_Rise_ramp);
      }
      if(m_Rise_capIsSet)
      {
          val[utility::conversions::to_string_t("rise_cap")] = ModelBase::toJson(m_Rise_cap);
      }
  
      return val;
  }
  
  bool PinState::fromJson(const web::json::value& val)
  {
      bool ok = true;
      
      if(val.has_field(utility::conversions::to_string_t("pin")))
      {
          const web::json::value& fieldValue = val.at(utility::conversions::to_string_t("pin"));
          if(!fieldValue.is_null())
          {
              utility::string_t refVal_pin;
              ok &= ModelBase::fromJson(fieldValue, refVal_pin);
              setPin(refVal_pin);
          }
      }
      if(val.has_field(utility::conversions::to_string_t("state")))
      {
          const web::json::value& fieldValue = val.at(utility::conversions::to_string_t("state"));
          if(!fieldValue.is_null())
          {
              utility::string_t refVal_state;
              ok &= ModelBase::fromJson(fieldValue, refVal_state);
              setState(refVal_state);
          }
      }
      if(val.has_field(utility::conversions::to_string_t("fall_ramp")))
      {
          const web::json::value& fieldValue = val.at(utility::conversions::to_string_t("fall_ramp"));
          if(!fieldValue.is_null())
          {
              double refVal_fall_ramp;
              ok &= ModelBase::fromJson(fieldValue, refVal_fall_ramp);
              setFallRamp(refVal_fall_ramp);
          }
      }
      if(val.has_field(utility::conversions::to_string_t("fall_cap")))
      {
          const web::json::value& fieldValue = val.at(utility::conversions::to_string_t("fall_cap"));
          if(!fieldValue.is_null())
          {
              double refVal_fall_cap;
              ok &= ModelBase::fromJson(fieldValue, refVal_fall_cap);
              setFallCap(refVal_fall_cap);
          }
      }
      if(val.has_field(utility::conversions::to_string_t("rise_ramp")))
      {
          const web::json::value& fieldValue = val.at(utility::conversions::to_string_t("rise_ramp"));
          if(!fieldValue.is_null())
          {
              double refVal_rise_ramp;
              ok &= ModelBase::fromJson(fieldValue, refVal_rise_ramp);
              setRiseRamp(refVal_rise_ramp);
          }
      }
      if(val.has_field(utility::conversions::to_string_t("rise_cap")))
      {
          const web::json::value& fieldValue = val.at(utility::conversions::to_string_t("rise_cap"));
          if(!fieldValue.is_null())
          {
              double refVal_rise_cap;
              ok &= ModelBase::fromJson(fieldValue, refVal_rise_cap);
              setRiseCap(refVal_rise_cap);
          }
      }
      return ok;
  }
  
  void PinState::toMultipart(std::shared_ptr<MultipartFormData> multipart, const utility::string_t& prefix) const
  {
      utility::string_t namePrefix = prefix;
      if(namePrefix.size() > 0 && namePrefix.substr(namePrefix.size() - 1) != utility::conversions::to_string_t("."))
      {
          namePrefix += utility::conversions::to_string_t(".");
      }
      if(m_PinIsSet)
      {
          multipart->add(ModelBase::toHttpContent(namePrefix + utility::conversions::to_string_t("pin"), m_Pin));
      }
      if(m_StateIsSet)
      {
          multipart->add(ModelBase::toHttpContent(namePrefix + utility::conversions::to_string_t("state"), m_State));
      }
      if(m_Fall_rampIsSet)
      {
          multipart->add(ModelBase::toHttpContent(namePrefix + utility::conversions::to_string_t("fall_ramp"), m_Fall_ramp));
      }
      if(m_Fall_capIsSet)
      {
          multipart->add(ModelBase::toHttpContent(namePrefix + utility::conversions::to_string_t("fall_cap"), m_Fall_cap));
      }
      if(m_Rise_rampIsSet)
      {
          multipart->add(ModelBase::toHttpContent(namePrefix + utility::conversions::to_string_t("rise_ramp"), m_Rise_ramp));
      }
      if(m_Rise_capIsSet)
      {
          multipart->add(ModelBase::toHttpContent(namePrefix + utility::conversions::to_string_t("rise_cap"), m_Rise_cap));
      }
  }
  
  bool PinState::fromMultiPart(std::shared_ptr<MultipartFormData> multipart, const utility::string_t& prefix)
  {
      bool ok = true;
      utility::string_t namePrefix = prefix;
      if(namePrefix.size() > 0 && namePrefix.substr(namePrefix.size() - 1) != utility::conversions::to_string_t("."))
      {
          namePrefix += utility::conversions::to_string_t(".");
      }
  
      if(multipart->hasContent(utility::conversions::to_string_t("pin")))
      {
          utility::string_t refVal_pin;
          ok &= ModelBase::fromHttpContent(multipart->getContent(utility::conversions::to_string_t("pin")), refVal_pin );
          setPin(refVal_pin);
      }
      if(multipart->hasContent(utility::conversions::to_string_t("state")))
      {
          utility::string_t refVal_state;
          ok &= ModelBase::fromHttpContent(multipart->getContent(utility::conversions::to_string_t("state")), refVal_state );
          setState(refVal_state);
      }
      if(multipart->hasContent(utility::conversions::to_string_t("fall_ramp")))
      {
          double refVal_fall_ramp;
          ok &= ModelBase::fromHttpContent(multipart->getContent(utility::conversions::to_string_t("fall_ramp")), refVal_fall_ramp );
          setFallRamp(refVal_fall_ramp);
      }
      if(multipart->hasContent(utility::conversions::to_string_t("fall_cap")))
      {
          double refVal_fall_cap;
          ok &= ModelBase::fromHttpContent(multipart->getContent(utility::conversions::to_string_t("fall_cap")), refVal_fall_cap );
          setFallCap(refVal_fall_cap);
      }
      if(multipart->hasContent(utility::conversions::to_string_t("rise_ramp")))
      {
          double refVal_rise_ramp;
          ok &= ModelBase::fromHttpContent(multipart->getContent(utility::conversions::to_string_t("rise_ramp")), refVal_rise_ramp );
          setRiseRamp(refVal_rise_ramp);
      }
      if(multipart->hasContent(utility::conversions::to_string_t("rise_cap")))
      {
          double refVal_rise_cap;
          ok &= ModelBase::fromHttpContent(multipart->getContent(utility::conversions::to_string_t("rise_cap")), refVal_rise_cap );
          setRiseCap(refVal_rise_cap);
      }
      return ok;
  }
  
  utility::string_t PinState::getPin() const
  {
      return m_Pin;
  }
  
  void PinState::setPin(const utility::string_t& value)
  {
      m_Pin = value;
      m_PinIsSet = true;
  }
  
  bool PinState::pinIsSet() const
  {
      return m_PinIsSet;
  }
  
  void PinState::unsetPin()
  {
      m_PinIsSet = false;
  }
  utility::string_t PinState::getState() const
  {
      return m_State;
  }
  
  void PinState::setState(const utility::string_t& value)
  {
      m_State = value;
      m_StateIsSet = true;
  }
  
  bool PinState::stateIsSet() const
  {
      return m_StateIsSet;
  }
  
  void PinState::unsetState()
  {
      m_StateIsSet = false;
  }
  double PinState::getFallRamp() const
  {
      return m_Fall_ramp;
  }
  
  void PinState::setFallRamp(double value)
  {
      m_Fall_ramp = value;
      m_Fall_rampIsSet = true;
  }
  
  bool PinState::fallRampIsSet() const
  {
      return m_Fall_rampIsSet;
  }
  
  void PinState::unsetFall_ramp()
  {
      m_Fall_rampIsSet = false;
  }
  double PinState::getFallCap() const
  {
      return m_Fall_cap;
  }
  
  void PinState::setFallCap(double value)
  {
      m_Fall_cap = value;
      m_Fall_capIsSet = true;
  }
  
  bool PinState::fallCapIsSet() const
  {
      return m_Fall_capIsSet;
  }
  
  void PinState::unsetFall_cap()
  {
      m_Fall_capIsSet = false;
  }
  double PinState::getRiseRamp() const
  {
      return m_Rise_ramp;
  }
  
  void PinState::setRiseRamp(double value)
  {
      m_Rise_ramp = value;
      m_Rise_rampIsSet = true;
  }
  
  bool PinState::riseRampIsSet() const
  {
      return m_Rise_rampIsSet;
  }
  
  void PinState::unsetRise_ramp()
  {
      m_Rise_rampIsSet = false;
  }
  double PinState::getRiseCap() const
  {
      return m_Rise_cap;
  }
  
  void PinState::setRiseCap(double value)
  {
      m_Rise_cap = value;
      m_Rise_capIsSet = true;
  }
  
  bool PinState::riseCapIsSet() const
  {
      return m_Rise_capIsSet;
  }
  
  void PinState::unsetRise_cap()
  {
      m_Rise_capIsSet = false;
  }
  }
  }
  
  
  