text: ﻿/**
   * Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved.
   * SPDX-License-Identifier: Apache-2.0.
   */
  
  #include <aws/amplifyuibuilder/model/UpdateThemeData.h>
  #include <aws/core/utils/json/JsonSerializer.h>
  
  #include <utility>
  
  using namespace Aws::Utils::Json;
  using namespace Aws::Utils;
  
  namespace Aws
  {
  namespace AmplifyUIBuilder
  {
  namespace Model
  {
  
  UpdateThemeData::UpdateThemeData() : 
      m_idHasBeenSet(false),
      m_nameHasBeenSet(false),
      m_overridesHasBeenSet(false),
      m_valuesHasBeenSet(false)
  {
  }
  
  UpdateThemeData::UpdateThemeData(JsonView jsonValue) : 
      m_idHasBeenSet(false),
      m_nameHasBeenSet(false),
      m_overridesHasBeenSet(false),
      m_valuesHasBeenSet(false)
  {
    *this = jsonValue;
  }
  
  UpdateThemeData& UpdateThemeData::operator =(JsonView jsonValue)
  {
    if(jsonValue.ValueExists("id"))
    {
      m_id = jsonValue.GetString("id");
  
      m_idHasBeenSet = true;
    }
  
    if(jsonValue.ValueExists("name"))
    {
      m_name = jsonValue.GetString("name");
  
      m_nameHasBeenSet = true;
    }
  
    if(jsonValue.ValueExists("overrides"))
    {
      Array<JsonView> overridesJsonList = jsonValue.GetArray("overrides");
      for(unsigned overridesIndex = 0; overridesIndex < overridesJsonList.GetLength(); ++overridesIndex)
      {
        m_overrides.push_back(overridesJsonList[overridesIndex].AsObject());
      }
      m_overridesHasBeenSet = true;
    }
  
    if(jsonValue.ValueExists("values"))
    {
      Array<JsonView> valuesJsonList = jsonValue.GetArray("values");
      for(unsigned valuesIndex = 0; valuesIndex < valuesJsonList.GetLength(); ++valuesIndex)
      {
        m_values.push_back(valuesJsonList[valuesIndex].AsObject());
      }
      m_valuesHasBeenSet = true;
    }
  
    return *this;
  }
  
  JsonValue UpdateThemeData::Jsonize() const
  {
    JsonValue payload;
  
    if(m_idHasBeenSet)
    {
     payload.WithString("id", m_id);
  
    }
  
    if(m_nameHasBeenSet)
    {
     payload.WithString("name", m_name);
  
    }
  
    if(m_overridesHasBeenSet)
    {
     Array<JsonValue> overridesJsonList(m_overrides.size());
     for(unsigned overridesIndex = 0; overridesIndex < overridesJsonList.GetLength(); ++overridesIndex)
     {
       overridesJsonList[overridesIndex].AsObject(m_overrides[overridesIndex].Jsonize());
     }
     payload.WithArray("overrides", std::move(overridesJsonList));
  
    }
  
    if(m_valuesHasBeenSet)
    {
     Array<JsonValue> valuesJsonList(m_values.size());
     for(unsigned valuesIndex = 0; valuesIndex < valuesJsonList.GetLength(); ++valuesIndex)
     {
       valuesJsonList[valuesIndex].AsObject(m_values[valuesIndex].Jsonize());
     }
     payload.WithArray("values", std::move(valuesJsonList));
  
    }
  
    return payload;
  }
  
  } // namespace Model
  } // namespace AmplifyUIBuilder
  } // namespace Aws
  