1 /**
2  * Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved.
3  * SPDX-License-Identifier: Apache-2.0.
4  */
5 
6 #include <aws/lexv2-models/model/BotLocaleSummary.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 LexModelsV2
17 {
18 namespace Model
19 {
20 
BotLocaleSummary()21 BotLocaleSummary::BotLocaleSummary() :
22     m_localeIdHasBeenSet(false),
23     m_localeNameHasBeenSet(false),
24     m_descriptionHasBeenSet(false),
25     m_botLocaleStatus(BotLocaleStatus::NOT_SET),
26     m_botLocaleStatusHasBeenSet(false),
27     m_lastUpdatedDateTimeHasBeenSet(false),
28     m_lastBuildSubmittedDateTimeHasBeenSet(false)
29 {
30 }
31 
BotLocaleSummary(JsonView jsonValue)32 BotLocaleSummary::BotLocaleSummary(JsonView jsonValue) :
33     m_localeIdHasBeenSet(false),
34     m_localeNameHasBeenSet(false),
35     m_descriptionHasBeenSet(false),
36     m_botLocaleStatus(BotLocaleStatus::NOT_SET),
37     m_botLocaleStatusHasBeenSet(false),
38     m_lastUpdatedDateTimeHasBeenSet(false),
39     m_lastBuildSubmittedDateTimeHasBeenSet(false)
40 {
41   *this = jsonValue;
42 }
43 
operator =(JsonView jsonValue)44 BotLocaleSummary& BotLocaleSummary::operator =(JsonView jsonValue)
45 {
46   if(jsonValue.ValueExists("localeId"))
47   {
48     m_localeId = jsonValue.GetString("localeId");
49 
50     m_localeIdHasBeenSet = true;
51   }
52 
53   if(jsonValue.ValueExists("localeName"))
54   {
55     m_localeName = jsonValue.GetString("localeName");
56 
57     m_localeNameHasBeenSet = true;
58   }
59 
60   if(jsonValue.ValueExists("description"))
61   {
62     m_description = jsonValue.GetString("description");
63 
64     m_descriptionHasBeenSet = true;
65   }
66 
67   if(jsonValue.ValueExists("botLocaleStatus"))
68   {
69     m_botLocaleStatus = BotLocaleStatusMapper::GetBotLocaleStatusForName(jsonValue.GetString("botLocaleStatus"));
70 
71     m_botLocaleStatusHasBeenSet = true;
72   }
73 
74   if(jsonValue.ValueExists("lastUpdatedDateTime"))
75   {
76     m_lastUpdatedDateTime = jsonValue.GetDouble("lastUpdatedDateTime");
77 
78     m_lastUpdatedDateTimeHasBeenSet = true;
79   }
80 
81   if(jsonValue.ValueExists("lastBuildSubmittedDateTime"))
82   {
83     m_lastBuildSubmittedDateTime = jsonValue.GetDouble("lastBuildSubmittedDateTime");
84 
85     m_lastBuildSubmittedDateTimeHasBeenSet = true;
86   }
87 
88   return *this;
89 }
90 
Jsonize() const91 JsonValue BotLocaleSummary::Jsonize() const
92 {
93   JsonValue payload;
94 
95   if(m_localeIdHasBeenSet)
96   {
97    payload.WithString("localeId", m_localeId);
98 
99   }
100 
101   if(m_localeNameHasBeenSet)
102   {
103    payload.WithString("localeName", m_localeName);
104 
105   }
106 
107   if(m_descriptionHasBeenSet)
108   {
109    payload.WithString("description", m_description);
110 
111   }
112 
113   if(m_botLocaleStatusHasBeenSet)
114   {
115    payload.WithString("botLocaleStatus", BotLocaleStatusMapper::GetNameForBotLocaleStatus(m_botLocaleStatus));
116   }
117 
118   if(m_lastUpdatedDateTimeHasBeenSet)
119   {
120    payload.WithDouble("lastUpdatedDateTime", m_lastUpdatedDateTime.SecondsWithMSPrecision());
121   }
122 
123   if(m_lastBuildSubmittedDateTimeHasBeenSet)
124   {
125    payload.WithDouble("lastBuildSubmittedDateTime", m_lastBuildSubmittedDateTime.SecondsWithMSPrecision());
126   }
127 
128   return payload;
129 }
130 
131 } // namespace Model
132 } // namespace LexModelsV2
133 } // namespace Aws
134