1 /**
2  * Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved.
3  * SPDX-License-Identifier: Apache-2.0.
4  */
5 
6 #include <aws/route53domains/model/ContactType.h>
7 #include <aws/core/utils/HashingUtils.h>
8 #include <aws/core/Globals.h>
9 #include <aws/core/utils/EnumParseOverflowContainer.h>
10 
11 using namespace Aws::Utils;
12 
13 
14 namespace Aws
15 {
16   namespace Route53Domains
17   {
18     namespace Model
19     {
20       namespace ContactTypeMapper
21       {
22 
23         static const int PERSON_HASH = HashingUtils::HashString("PERSON");
24         static const int COMPANY_HASH = HashingUtils::HashString("COMPANY");
25         static const int ASSOCIATION_HASH = HashingUtils::HashString("ASSOCIATION");
26         static const int PUBLIC_BODY_HASH = HashingUtils::HashString("PUBLIC_BODY");
27         static const int RESELLER_HASH = HashingUtils::HashString("RESELLER");
28 
29 
GetContactTypeForName(const Aws::String & name)30         ContactType GetContactTypeForName(const Aws::String& name)
31         {
32           int hashCode = HashingUtils::HashString(name.c_str());
33           if (hashCode == PERSON_HASH)
34           {
35             return ContactType::PERSON;
36           }
37           else if (hashCode == COMPANY_HASH)
38           {
39             return ContactType::COMPANY;
40           }
41           else if (hashCode == ASSOCIATION_HASH)
42           {
43             return ContactType::ASSOCIATION;
44           }
45           else if (hashCode == PUBLIC_BODY_HASH)
46           {
47             return ContactType::PUBLIC_BODY;
48           }
49           else if (hashCode == RESELLER_HASH)
50           {
51             return ContactType::RESELLER;
52           }
53           EnumParseOverflowContainer* overflowContainer = Aws::GetEnumOverflowContainer();
54           if(overflowContainer)
55           {
56             overflowContainer->StoreOverflow(hashCode, name);
57             return static_cast<ContactType>(hashCode);
58           }
59 
60           return ContactType::NOT_SET;
61         }
62 
GetNameForContactType(ContactType enumValue)63         Aws::String GetNameForContactType(ContactType enumValue)
64         {
65           switch(enumValue)
66           {
67           case ContactType::PERSON:
68             return "PERSON";
69           case ContactType::COMPANY:
70             return "COMPANY";
71           case ContactType::ASSOCIATION:
72             return "ASSOCIATION";
73           case ContactType::PUBLIC_BODY:
74             return "PUBLIC_BODY";
75           case ContactType::RESELLER:
76             return "RESELLER";
77           default:
78             EnumParseOverflowContainer* overflowContainer = Aws::GetEnumOverflowContainer();
79             if(overflowContainer)
80             {
81               return overflowContainer->RetrieveOverflow(static_cast<int>(enumValue));
82             }
83 
84             return {};
85           }
86         }
87 
88       } // namespace ContactTypeMapper
89     } // namespace Model
90   } // namespace Route53Domains
91 } // namespace Aws
92