text: ﻿/*
  * Copyright 2010-2017 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/waf/model/SizeConstraint.h>
  #include <aws/core/utils/json/JsonSerializer.h>
  
  #include <utility>
  
  using namespace Aws::Utils::Json;
  using namespace Aws::Utils;
  
  namespace Aws
  {
  namespace WAF
  {
  namespace Model
  {
  
  SizeConstraint::SizeConstraint() : 
      m_fieldToMatchHasBeenSet(false),
      m_textTransformation(TextTransformation::NOT_SET),
      m_textTransformationHasBeenSet(false),
      m_comparisonOperator(ComparisonOperator::NOT_SET),
      m_comparisonOperatorHasBeenSet(false),
      m_size(0),
      m_sizeHasBeenSet(false)
  {
  }
  
  SizeConstraint::SizeConstraint(const JsonValue& jsonValue) : 
      m_fieldToMatchHasBeenSet(false),
      m_textTransformation(TextTransformation::NOT_SET),
      m_textTransformationHasBeenSet(false),
      m_comparisonOperator(ComparisonOperator::NOT_SET),
      m_comparisonOperatorHasBeenSet(false),
      m_size(0),
      m_sizeHasBeenSet(false)
  {
    *this = jsonValue;
  }
  
  SizeConstraint& SizeConstraint::operator =(const JsonValue& jsonValue)
  {
    if(jsonValue.ValueExists("FieldToMatch"))
    {
      m_fieldToMatch = jsonValue.GetObject("FieldToMatch");
  
      m_fieldToMatchHasBeenSet = true;
    }
  
    if(jsonValue.ValueExists("TextTransformation"))
    {
      m_textTransformation = TextTransformationMapper::GetTextTransformationForName(jsonValue.GetString("TextTransformation"));
  
      m_textTransformationHasBeenSet = true;
    }
  
    if(jsonValue.ValueExists("ComparisonOperator"))
    {
      m_comparisonOperator = ComparisonOperatorMapper::GetComparisonOperatorForName(jsonValue.GetString("ComparisonOperator"));
  
      m_comparisonOperatorHasBeenSet = true;
    }
  
    if(jsonValue.ValueExists("Size"))
    {
      m_size = jsonValue.GetInt64("Size");
  
      m_sizeHasBeenSet = true;
    }
  
    return *this;
  }
  
  JsonValue SizeConstraint::Jsonize() const
  {
    JsonValue payload;
  
    if(m_fieldToMatchHasBeenSet)
    {
     payload.WithObject("FieldToMatch", m_fieldToMatch.Jsonize());
  
    }
  
    if(m_textTransformationHasBeenSet)
    {
     payload.WithString("TextTransformation", TextTransformationMapper::GetNameForTextTransformation(m_textTransformation));
    }
  
    if(m_comparisonOperatorHasBeenSet)
    {
     payload.WithString("ComparisonOperator", ComparisonOperatorMapper::GetNameForComparisonOperator(m_comparisonOperator));
    }
  
    if(m_sizeHasBeenSet)
    {
     payload.WithInt64("Size", m_size);
  
    }
  
    return payload;
  }
  
  } // namespace Model
  } // namespace WAF
  } // namespace Aws
  