text: ﻿/*
  * Copyright 2010-2016 Amazon.com, Inc. or its affiliates. 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.
  * A copy of the License is located at
  *
  *  http://aws.amazon.com/apache2.0
  *
  * or in the "license" file accompanying this file. This file 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 <aws/devicefarm/model/RemoteAccessSession.h>
  #include <aws/core/utils/json/JsonSerializer.h>
  
  #include <utility>
  
  using namespace Aws::Utils::Json;
  using namespace Aws::Utils;
  
  namespace Aws
  {
  namespace DeviceFarm
  {
  namespace Model
  {
  
  RemoteAccessSession::RemoteAccessSession() : 
      m_arnHasBeenSet(false),
      m_nameHasBeenSet(false),
      m_createdHasBeenSet(false),
      m_statusHasBeenSet(false),
      m_resultHasBeenSet(false),
      m_messageHasBeenSet(false),
      m_startedHasBeenSet(false),
      m_stoppedHasBeenSet(false),
      m_deviceHasBeenSet(false),
      m_billingMethodHasBeenSet(false),
      m_deviceMinutesHasBeenSet(false),
      m_endpointHasBeenSet(false)
  {
  }
  
  RemoteAccessSession::RemoteAccessSession(const JsonValue& jsonValue) : 
      m_arnHasBeenSet(false),
      m_nameHasBeenSet(false),
      m_createdHasBeenSet(false),
      m_statusHasBeenSet(false),
      m_resultHasBeenSet(false),
      m_messageHasBeenSet(false),
      m_startedHasBeenSet(false),
      m_stoppedHasBeenSet(false),
      m_deviceHasBeenSet(false),
      m_billingMethodHasBeenSet(false),
      m_deviceMinutesHasBeenSet(false),
      m_endpointHasBeenSet(false)
  {
    *this = jsonValue;
  }
  
  RemoteAccessSession& RemoteAccessSession::operator =(const JsonValue& jsonValue)
  {
    if(jsonValue.ValueExists("arn"))
    {
      m_arn = jsonValue.GetString("arn");
  
      m_arnHasBeenSet = true;
    }
  
    if(jsonValue.ValueExists("name"))
    {
      m_name = jsonValue.GetString("name");
  
      m_nameHasBeenSet = true;
    }
  
    if(jsonValue.ValueExists("created"))
    {
      m_created = jsonValue.GetDouble("created");
  
      m_createdHasBeenSet = true;
    }
  
    if(jsonValue.ValueExists("status"))
    {
      m_status = ExecutionStatusMapper::GetExecutionStatusForName(jsonValue.GetString("status"));
  
      m_statusHasBeenSet = true;
    }
  
    if(jsonValue.ValueExists("result"))
    {
      m_result = ExecutionResultMapper::GetExecutionResultForName(jsonValue.GetString("result"));
  
      m_resultHasBeenSet = true;
    }
  
    if(jsonValue.ValueExists("message"))
    {
      m_message = jsonValue.GetString("message");
  
      m_messageHasBeenSet = true;
    }
  
    if(jsonValue.ValueExists("started"))
    {
      m_started = jsonValue.GetDouble("started");
  
      m_startedHasBeenSet = true;
    }
  
    if(jsonValue.ValueExists("stopped"))
    {
      m_stopped = jsonValue.GetDouble("stopped");
  
      m_stoppedHasBeenSet = true;
    }
  
    if(jsonValue.ValueExists("device"))
    {
      m_device = jsonValue.GetObject("device");
  
      m_deviceHasBeenSet = true;
    }
  
    if(jsonValue.ValueExists("billingMethod"))
    {
      m_billingMethod = BillingMethodMapper::GetBillingMethodForName(jsonValue.GetString("billingMethod"));
  
      m_billingMethodHasBeenSet = true;
    }
  
    if(jsonValue.ValueExists("deviceMinutes"))
    {
      m_deviceMinutes = jsonValue.GetObject("deviceMinutes");
  
      m_deviceMinutesHasBeenSet = true;
    }
  
    if(jsonValue.ValueExists("endpoint"))
    {
      m_endpoint = jsonValue.GetString("endpoint");
  
      m_endpointHasBeenSet = true;
    }
  
    return *this;
  }
  
  JsonValue RemoteAccessSession::Jsonize() const
  {
    JsonValue payload;
  
    if(m_arnHasBeenSet)
    {
     payload.WithString("arn", m_arn);
  
    }
  
    if(m_nameHasBeenSet)
    {
     payload.WithString("name", m_name);
  
    }
  
    if(m_createdHasBeenSet)
    {
     payload.WithDouble("created", m_created.SecondsWithMSPrecision());
    }
  
    if(m_statusHasBeenSet)
    {
     payload.WithString("status", ExecutionStatusMapper::GetNameForExecutionStatus(m_status));
    }
  
    if(m_resultHasBeenSet)
    {
     payload.WithString("result", ExecutionResultMapper::GetNameForExecutionResult(m_result));
    }
  
    if(m_messageHasBeenSet)
    {
     payload.WithString("message", m_message);
  
    }
  
    if(m_startedHasBeenSet)
    {
     payload.WithDouble("started", m_started.SecondsWithMSPrecision());
    }
  
    if(m_stoppedHasBeenSet)
    {
     payload.WithDouble("stopped", m_stopped.SecondsWithMSPrecision());
    }
  
    if(m_deviceHasBeenSet)
    {
     payload.WithObject("device", m_device.Jsonize());
  
    }
  
    if(m_billingMethodHasBeenSet)
    {
     payload.WithString("billingMethod", BillingMethodMapper::GetNameForBillingMethod(m_billingMethod));
    }
  
    if(m_deviceMinutesHasBeenSet)
    {
     payload.WithObject("deviceMinutes", m_deviceMinutes.Jsonize());
  
    }
  
    if(m_endpointHasBeenSet)
    {
     payload.WithString("endpoint", m_endpoint);
  
    }
  
    return payload;
  }
  
  } // namespace Model
  } // namespace DeviceFarm
  } // namespace Aws