text: /*
   * Copyright (c) 2017-2019 THL A29 Limited, a Tencent company. All Rights Reserved.
   *
   * Licensed under the Apache License, Version 2.0 (the "License");
   * you may not use this file except in compliance with the License.
   * You may obtain a copy of the License at
   *
   *    http://www.apache.org/licenses/LICENSE-2.0
   *
   * Unless required by applicable law or agreed to in writing, software
   * distributed under the License is distributed on an "AS IS" BASIS,
   * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
   * See the License for the specific language governing permissions and
   * limitations under the License.
   */
  
  #include <tencentcloud/batch/v20170312/model/Instance.h>
  
  using TencentCloud::CoreInternalOutcome;
  using namespace TencentCloud::Batch::V20170312::Model;
  using namespace rapidjson;
  using namespace std;
  
  Instance::Instance() :
      m_instanceIdHasBeenSet(false),
      m_imageIdHasBeenSet(false),
      m_loginSettingsHasBeenSet(false)
  {
  }
  
  CoreInternalOutcome Instance::Deserialize(const Value &value)
  {
      string requestId = "";
  
  
      if (value.HasMember("InstanceId") && !value["InstanceId"].IsNull())
      {
          if (!value["InstanceId"].IsString())
          {
              return CoreInternalOutcome(Error("response `Instance.InstanceId` IsString=false incorrectly").SetRequestId(requestId));
          }
          m_instanceId = string(value["InstanceId"].GetString());
          m_instanceIdHasBeenSet = true;
      }
  
      if (value.HasMember("ImageId") && !value["ImageId"].IsNull())
      {
          if (!value["ImageId"].IsString())
          {
              return CoreInternalOutcome(Error("response `Instance.ImageId` IsString=false incorrectly").SetRequestId(requestId));
          }
          m_imageId = string(value["ImageId"].GetString());
          m_imageIdHasBeenSet = true;
      }
  
      if (value.HasMember("LoginSettings") && !value["LoginSettings"].IsNull())
      {
          if (!value["LoginSettings"].IsObject())
          {
              return CoreInternalOutcome(Error("response `Instance.LoginSettings` is not object type").SetRequestId(requestId));
          }
  
          CoreInternalOutcome outcome = m_loginSettings.Deserialize(value["LoginSettings"]);
          if (!outcome.IsSuccess())
          {
              outcome.GetError().SetRequestId(requestId);
              return outcome;
          }
  
          m_loginSettingsHasBeenSet = true;
      }
  
  
      return CoreInternalOutcome(true);
  }
  
  void Instance::ToJsonObject(Value &value, Document::AllocatorType& allocator) const
  {
  
      if (m_instanceIdHasBeenSet)
      {
          Value iKey(kStringType);
          string key = "InstanceId";
          iKey.SetString(key.c_str(), allocator);
          value.AddMember(iKey, Value(m_instanceId.c_str(), allocator).Move(), allocator);
      }
  
      if (m_imageIdHasBeenSet)
      {
          Value iKey(kStringType);
          string key = "ImageId";
          iKey.SetString(key.c_str(), allocator);
          value.AddMember(iKey, Value(m_imageId.c_str(), allocator).Move(), allocator);
      }
  
      if (m_loginSettingsHasBeenSet)
      {
          Value iKey(kStringType);
          string key = "LoginSettings";
          iKey.SetString(key.c_str(), allocator);
          value.AddMember(iKey, Value(kObjectType).Move(), allocator);
          m_loginSettings.ToJsonObject(value[key.c_str()], allocator);
      }
  
  }
  
  
  string Instance::GetInstanceId() const
  {
      return m_instanceId;
  }
  
  void Instance::SetInstanceId(const string& _instanceId)
  {
      m_instanceId = _instanceId;
      m_instanceIdHasBeenSet = true;
  }
  
  bool Instance::InstanceIdHasBeenSet() const
  {
      return m_instanceIdHasBeenSet;
  }
  
  string Instance::GetImageId() const
  {
      return m_imageId;
  }
  
  void Instance::SetImageId(const string& _imageId)
  {
      m_imageId = _imageId;
      m_imageIdHasBeenSet = true;
  }
  
  bool Instance::ImageIdHasBeenSet() const
  {
      return m_imageIdHasBeenSet;
  }
  
  LoginSettings Instance::GetLoginSettings() const
  {
      return m_loginSettings;
  }
  
  void Instance::SetLoginSettings(const LoginSettings& _loginSettings)
  {
      m_loginSettings = _loginSettings;
      m_loginSettingsHasBeenSet = true;
  }
  
  bool Instance::LoginSettingsHasBeenSet() const
  {
      return m_loginSettingsHasBeenSet;
  }
  
  