1 /*
2  * Copyright (C) 2006-2021 Registro.br. All rights reserved.
3  *
4  * Redistribution and use in source and binary forms, with or without
5  * modification, are permitted provided that the following conditions are
6  * met:
7  * 1. Redistribution of source code must retain the above copyright
8  *    notice, this list of conditions and the following disclaimer.
9  * 2. Redistributions in binary form must reproduce the above copyright
10  *    notice, this list of conditions and the following disclaimer in the
11  *    documentation and/or other materials provided with the distribution.
12  *
13  * THIS SOFTWARE IS PROVIDED BY REGISTRO.BR ``AS IS AND ANY EXPRESS OR
14  * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
15  * WARRANTIE OF FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO
16  * EVENT SHALL REGISTRO.BR BE LIABLE FOR ANY DIRECT, INDIRECT,
17  * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING,
18  * BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS
19  * OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
20  * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR
21  * TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE
22  * USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH
23  * DAMAGE.
24  */
25 /* $Id$ */
26 /** @file  Launch.H
27  *  @brief EPP LaunchCheckRsp Class
28  */
29 
30 #ifndef __LAUNCH_CHECK_RSP_H__
31 #define __LAUNCH_CHECK_RSP_H__
32 
33 #include <list>
34 #include <string>
35 
36 #include "Launch.H"
37 
38 using std::list;
39 using std::string;
40 
41 LIBEPP_NICBR_NS_BEGIN
42 
43 /// EPP LaunchCheckRsp Class
44 class LaunchCheckRsp
45 {
46 public:
47 	/// EPP LaunchCheckRsp::Name Class
48 	class Name {
49 	public:
50 		/// Default constructor
Name()51 		Name()
52 		{
53 			reset();
54 		}
55 
56 		/// Sets the fully qualified name of the queried domain name
57 		/**
58 		 * @param fqdn fully qualified name of the queried domain name
59 		 */
set_fqdn(const string & fqdn)60 		void set_fqdn(const string &fqdn) { _fqdn = fqdn; }
61 
62 		/// Returns the fully qualified name of the queried domain name
63 		/**
64 		 * @return fully qualified name of the queried domain name
65 		 */
get_fqdn()66 		string get_fqdn() const { return _fqdn; }
67 
68 		/// Sets the existence of a trademark
69 		/**
70 		 * @param exists trademark existence
71 		 */
set_exists(const bool exists)72 		void set_exists(const bool exists) { _exists = exists; }
73 
74 		/// Returns the existence of a trademark
75 		/**
76 		 * @return trademark existence
77 		 */
exists()78 		bool exists() const { return _exists; }
79 
80 		/// Reset object attributes
reset()81 		void reset()
82 		{
83 			_fqdn.clear();
84 			_exists = false;
85 		}
86 
87 	private:
88 		/// Contains the fully qualified name of the queried domain name
89 		string _fqdn;
90 
91 		/// Indicates if a matching trademark exists for the domain name
92 		bool _exists;
93 	};
94 
95 	/// EPP LaunchCheckRsp::Result Class
96 	class Result
97 	{
98 	public:
99 		/// Default constructor
Result()100 		Result()
101 		{
102 			reset();
103 		}
104 
105 		/// Sets the fully qualified name of the queried domain name with
106 		/// the exists flag
107 		/**
108 		 * @param name fully qualified name of the queried domain name with
109 		 * the exists flag
110 		 */
set_name(const Name & name)111 		void set_name(const Name &name) { _name = name; }
112 
113 		/// Returns the fully qualified name of the queried domain name with
114 		/// the exists flag
115 		/**
116 		 * @return fully qualified name of the queried domain name with he
117 		 * exists flag
118 		 */
get_name()119 		Name get_name() const { return _name; }
120 
121 		/// Sets the claim key that MAY be passed to a third-party trademark
122 		/// validator such as the Trademark Clearinghouse (TMCH) for
123 		/// querying the information needed to generate a Trademark Claims
124 		/// Notice
125 		/**
126 		 * @param claimKey claim key
127 		 */
set_claimKey(const string & claimKey)128 		void set_claimKey(const string &claimKey) { _claimKey = claimKey; }
129 
130 		/// Returns the claim key that MAY be passed to a third-party trademark
131 		/// validator such as the Trademark Clearinghouse (TMCH) for
132 		/// querying the information needed to generate a Trademark Claims
133 		/// Notice
134 		/**
135 		 * @return claim key
136 		 */
get_claimKey()137 		string get_claimKey() const { return _claimKey; }
138 
139 		/// Reset object attributes
reset()140 		void reset()
141 		{
142 			_name.reset();
143 			_claimKey.clear();
144 		}
145 
146 	private:
147 		/// Contains the fully qualified name of the queried domain name
148 		/// with the exists flag
149 		Name _name;
150 
151 		/// Claim key that MAY be passed to a third-party trademark
152 		/// validator such as the Trademark Clearinghouse (TMCH) for
153 		/// querying the information needed to generate a Trademark Claims
154 		/// Notice
155 		string _claimKey;
156 	};
157 
158 	/// Default constructor
LaunchCheckRsp()159 	LaunchCheckRsp()
160 	{
161 		reset();
162 	}
163 
164 	/// Sets the phase of the launch
165 	/**
166 	 * @param phase phase of the launch
167 	 */
set_phase(const LaunchPhase & phase)168 	void set_phase(const LaunchPhase &phase) { _phase = phase; }
169 
170 	/// Returns the phase of the launch
171 	/**
172 	 * @return phase of the launch
173 	 */
get_phase()174 	LaunchPhase get_phase() const { return _phase; }
175 
176 	/// Sets the list of results
177 	/**
178 	 * @param results list of results
179 	 */
set_results(const list<Result> & results)180 	void set_results(const list<Result> &results) { _results = results; }
181 
182 	/// Returns the list of results
183 	/**
184 	 * @return list of results
185 	 */
get_results()186 	list<Result> get_results() const { return _results; }
187 
188 	/// Add a launch result
189 	/**
190 	 * @param result launch result
191 	 */
add_result(const Result & result)192 	void add_result(const Result &result)
193 	{
194 		_results.push_back(result);
195 	}
196 
197 	/// Reset object attributes
reset()198 	void reset()
199 	{
200 		_phase.reset();
201 		_results.clear();
202 	}
203 
204 private:
205 	/// launch phase that SHOULD be "claims"
206 	LaunchPhase _phase;
207 
208 	/// List of results
209 	list<Result> _results;
210 };
211 
212 LIBEPP_NICBR_NS_END
213 
214 #endif // __LAUNCH_CHECK_RSP_H__
215