1 /**
2  * Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved.
3  * SPDX-License-Identifier: Apache-2.0.
4  */
5 
6 #include <aws/lex-models/model/OutputContext.h>
7 #include <aws/core/utils/json/JsonSerializer.h>
8 
9 #include <utility>
10 
11 using namespace Aws::Utils::Json;
12 using namespace Aws::Utils;
13 
14 namespace Aws
15 {
16 namespace LexModelBuildingService
17 {
18 namespace Model
19 {
20 
OutputContext()21 OutputContext::OutputContext() :
22     m_nameHasBeenSet(false),
23     m_timeToLiveInSeconds(0),
24     m_timeToLiveInSecondsHasBeenSet(false),
25     m_turnsToLive(0),
26     m_turnsToLiveHasBeenSet(false)
27 {
28 }
29 
OutputContext(JsonView jsonValue)30 OutputContext::OutputContext(JsonView jsonValue) :
31     m_nameHasBeenSet(false),
32     m_timeToLiveInSeconds(0),
33     m_timeToLiveInSecondsHasBeenSet(false),
34     m_turnsToLive(0),
35     m_turnsToLiveHasBeenSet(false)
36 {
37   *this = jsonValue;
38 }
39 
operator =(JsonView jsonValue)40 OutputContext& OutputContext::operator =(JsonView jsonValue)
41 {
42   if(jsonValue.ValueExists("name"))
43   {
44     m_name = jsonValue.GetString("name");
45 
46     m_nameHasBeenSet = true;
47   }
48 
49   if(jsonValue.ValueExists("timeToLiveInSeconds"))
50   {
51     m_timeToLiveInSeconds = jsonValue.GetInteger("timeToLiveInSeconds");
52 
53     m_timeToLiveInSecondsHasBeenSet = true;
54   }
55 
56   if(jsonValue.ValueExists("turnsToLive"))
57   {
58     m_turnsToLive = jsonValue.GetInteger("turnsToLive");
59 
60     m_turnsToLiveHasBeenSet = true;
61   }
62 
63   return *this;
64 }
65 
Jsonize() const66 JsonValue OutputContext::Jsonize() const
67 {
68   JsonValue payload;
69 
70   if(m_nameHasBeenSet)
71   {
72    payload.WithString("name", m_name);
73 
74   }
75 
76   if(m_timeToLiveInSecondsHasBeenSet)
77   {
78    payload.WithInteger("timeToLiveInSeconds", m_timeToLiveInSeconds);
79 
80   }
81 
82   if(m_turnsToLiveHasBeenSet)
83   {
84    payload.WithInteger("turnsToLive", m_turnsToLive);
85 
86   }
87 
88   return payload;
89 }
90 
91 } // namespace Model
92 } // namespace LexModelBuildingService
93 } // namespace Aws
94