text: ﻿/**
   * Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved.
   * SPDX-License-Identifier: Apache-2.0.
   */
  
  #include <aws/elasticmapreduce/model/PlacementType.h>
  #include <aws/core/utils/json/JsonSerializer.h>
  
  #include <utility>
  
  using namespace Aws::Utils::Json;
  using namespace Aws::Utils;
  
  namespace Aws
  {
  namespace EMR
  {
  namespace Model
  {
  
  PlacementType::PlacementType() : 
      m_availabilityZoneHasBeenSet(false),
      m_availabilityZonesHasBeenSet(false)
  {
  }
  
  PlacementType::PlacementType(JsonView jsonValue) : 
      m_availabilityZoneHasBeenSet(false),
      m_availabilityZonesHasBeenSet(false)
  {
    *this = jsonValue;
  }
  
  PlacementType& PlacementType::operator =(JsonView jsonValue)
  {
    if(jsonValue.ValueExists("AvailabilityZone"))
    {
      m_availabilityZone = jsonValue.GetString("AvailabilityZone");
  
      m_availabilityZoneHasBeenSet = true;
    }
  
    if(jsonValue.ValueExists("AvailabilityZones"))
    {
      Array<JsonView> availabilityZonesJsonList = jsonValue.GetArray("AvailabilityZones");
      for(unsigned availabilityZonesIndex = 0; availabilityZonesIndex < availabilityZonesJsonList.GetLength(); ++availabilityZonesIndex)
      {
        m_availabilityZones.push_back(availabilityZonesJsonList[availabilityZonesIndex].AsString());
      }
      m_availabilityZonesHasBeenSet = true;
    }
  
    return *this;
  }
  
  JsonValue PlacementType::Jsonize() const
  {
    JsonValue payload;
  
    if(m_availabilityZoneHasBeenSet)
    {
     payload.WithString("AvailabilityZone", m_availabilityZone);
  
    }
  
    if(m_availabilityZonesHasBeenSet)
    {
     Array<JsonValue> availabilityZonesJsonList(m_availabilityZones.size());
     for(unsigned availabilityZonesIndex = 0; availabilityZonesIndex < availabilityZonesJsonList.GetLength(); ++availabilityZonesIndex)
     {
       availabilityZonesJsonList[availabilityZonesIndex].AsString(m_availabilityZones[availabilityZonesIndex]);
     }
     payload.WithArray("AvailabilityZones", std::move(availabilityZonesJsonList));
  
    }
  
    return payload;
  }
  
  } // namespace Model
  } // namespace EMR
  } // namespace Aws
  