1 /**
2  * Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved.
3  * SPDX-License-Identifier: Apache-2.0.
4  */
5 
6 #include <aws/comprehendmedical/model/RxNormTrait.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 ComprehendMedical
17 {
18 namespace Model
19 {
20 
RxNormTrait()21 RxNormTrait::RxNormTrait() :
22     m_name(RxNormTraitName::NOT_SET),
23     m_nameHasBeenSet(false),
24     m_score(0.0),
25     m_scoreHasBeenSet(false)
26 {
27 }
28 
RxNormTrait(JsonView jsonValue)29 RxNormTrait::RxNormTrait(JsonView jsonValue) :
30     m_name(RxNormTraitName::NOT_SET),
31     m_nameHasBeenSet(false),
32     m_score(0.0),
33     m_scoreHasBeenSet(false)
34 {
35   *this = jsonValue;
36 }
37 
operator =(JsonView jsonValue)38 RxNormTrait& RxNormTrait::operator =(JsonView jsonValue)
39 {
40   if(jsonValue.ValueExists("Name"))
41   {
42     m_name = RxNormTraitNameMapper::GetRxNormTraitNameForName(jsonValue.GetString("Name"));
43 
44     m_nameHasBeenSet = true;
45   }
46 
47   if(jsonValue.ValueExists("Score"))
48   {
49     m_score = jsonValue.GetDouble("Score");
50 
51     m_scoreHasBeenSet = true;
52   }
53 
54   return *this;
55 }
56 
Jsonize() const57 JsonValue RxNormTrait::Jsonize() const
58 {
59   JsonValue payload;
60 
61   if(m_nameHasBeenSet)
62   {
63    payload.WithString("Name", RxNormTraitNameMapper::GetNameForRxNormTraitName(m_name));
64   }
65 
66   if(m_scoreHasBeenSet)
67   {
68    payload.WithDouble("Score", m_score);
69 
70   }
71 
72   return payload;
73 }
74 
75 } // namespace Model
76 } // namespace ComprehendMedical
77 } // namespace Aws
78