// Path: src/com/hoiio/sdk/objects/HoiioResponse.java
// public class HoiioResponse {
// 	
// 	protected String response;
// 	
// 	/**
// 	 * Constructs the {@code HoiioResponse} object
// 	 */
// 	public HoiioResponse() {
// 	}
// 	
// 	/**
// 	 * Gets the content of the response
// 	 * @return The raw content of the response
// 	 */
// 	public String getContent() {
// 		return response;
// 	}
// }
// 
// Path: src/com/hoiio/sdk/objects/enums/Currency.java
// public enum Currency {
// 
// 	SGD("SGD"),
// 	HKD("HKD"),
// 	USD("USD"),
// 	AUD("AUD");
// 	
// 	private static final Map<String, Currency> lookup = new HashMap<String, Currency>();
// 	
// 	private String currency;
// 	
// 	private Currency(String currency) {
// 		this.currency = currency;
// 	}
// 	
// 	/**
// 	 * Returns a string representation of the object
// 	 * @return string representation of the object
// 	 */
// 	public String toString() {
// 		return currency;
// 	}
// 	
// 	static {
// 		for (Currency s : Currency.values()) {
// 			lookup.put(s.toString(), s);
// 		}
// 	}
// 	
// 	/**
// 	 * Converts the string to {@code Currency} object
// 	 * @param currency The currency in string
// 	 * @return {@code Currency} object
// 	 */	
// 	public static Currency fromString(String currency) {
// 		return lookup.get(currency);
// 	}
// 	
// }


import net.sf.json.JSONObject;
import com.hoiio.sdk.objects.HoiioResponse;
import com.hoiio.sdk.objects.enums.Currency;
package com.hoiio.sdk.objects.sms;

/*
Copyright (C) 2012 Hoiio Pte Ltd (http://www.hoiio.com)

Permission is hereby granted, free of charge, to any person
obtaining a copy of this software and associated documentation
files (the "Software"), to deal in the Software without
restriction, including without limitation the rights to use,
copy, modify, merge, publish, distribute, sublicense, and/or sell
copies of the Software, and to permit persons to whom the
Software is furnished to do so, subject to the following
conditions:

The above copyright notice and this permission notice shall be
included in all copies or substantial portions of the Software.

THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES
OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT
HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY,
WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR
OTHER DEALINGS IN THE SOFTWARE.
*/



public class SmsRate extends HoiioResponse {
	
	private static enum Params {
		RATE, CURRENCY, SPLIT_COUNT, TOTAL_COST, IS_UNICODE;
		
		public String toString() {
			return this.name().toLowerCase();
		}
	}
	
	private Currency currency;
	private double rate;
	private Integer splitCount;
	private Double totalCost;
	private Boolean isUnicode;
	
	/**
	 * Constructs a new {@code SmsRate} object by decoding the {@code JSONObject} as a response from the HTTP Request 
	 * @param output The response of the HTTP Request
	 */
	public SmsRate(JSONObject output) {
		response = output.toString();
		
		currency = Currency.fromString(output.getString(Params.CURRENCY.toString()));
		rate = output.getDouble(Params.RATE.toString());
		
		if (output.containsKey(Params.SPLIT_COUNT.toString())) {
			splitCount = output.getInt(Params.SPLIT_COUNT.toString());
		}
		
// Path: src/com/hoiio/sdk/objects/HoiioResponse.java
// public class HoiioResponse {
// 	
// 	protected String response;
// 	
// 	/**
// 	 * Constructs the {@code HoiioResponse} object
// 	 */
// 	public HoiioResponse() {
// 	}
// 	
// 	/**
// 	 * Gets the content of the response
// 	 * @return The raw content of the response
// 	 */
// 	public String getContent() {
// 		return response;
// 	}
// }
// 
// Path: src/com/hoiio/sdk/objects/enums/Currency.java
// public enum Currency {
// 
// 	SGD("SGD"),
// 	HKD("HKD"),
// 	USD("USD"),
// 	AUD("AUD");
// 	
// 	private static final Map<String, Currency> lookup = new HashMap<String, Currency>();
// 	
// 	private String currency;
// 	
// 	private Currency(String currency) {
// 		this.currency = currency;
// 	}
// 	
// 	/**
// 	 * Returns a string representation of the object
// 	 * @return string representation of the object
// 	 */
// 	public String toString() {
// 		return currency;
// 	}
// 	
// 	static {
// 		for (Currency s : Currency.values()) {
// 			lookup.put(s.toString(), s);
// 		}
// 	}
// 	
// 	/**
// 	 * Converts the string to {@code Currency} object
// 	 * @param currency The currency in string
// 	 * @return {@code Currency} object
// 	 */	
// 	public static Currency fromString(String currency) {
// 		return lookup.get(currency);
// 	}
// 	
// }


// Path: src/com/hoiio/sdk/objects/sms/SmsRate.java
import net.sf.json.JSONObject;
import com.hoiio.sdk.objects.HoiioResponse;
import com.hoiio.sdk.objects.enums.Currency;

package com.hoiio.sdk.objects.sms;

/*
Copyright (C) 2012 Hoiio Pte Ltd (http://www.hoiio.com)

Permission is hereby granted, free of charge, to any person
obtaining a copy of this software and associated documentation
files (the "Software"), to deal in the Software without
restriction, including without limitation the rights to use,
copy, modify, merge, publish, distribute, sublicense, and/or sell
copies of the Software, and to permit persons to whom the
Software is furnished to do so, subject to the following
conditions:

The above copyright notice and this permission notice shall be
included in all copies or substantial portions of the Software.

THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES
OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT
HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY,
WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR
OTHER DEALINGS IN THE SOFTWARE.
*/



public class SmsRate extends HoiioResponse {
	
	private static enum Params {
		RATE, CURRENCY, SPLIT_COUNT, TOTAL_COST, IS_UNICODE;
		
		public String toString() {
			return this.name().toLowerCase();
		}
	}
	
	private Currency currency;
	private double rate;
	private Integer splitCount;
	private Double totalCost;
	private Boolean isUnicode;
	
	/**
	 * Constructs a new {@code SmsRate} object by decoding the {@code JSONObject} as a response from the HTTP Request 
	 * @param output The response of the HTTP Request
	 */
	public SmsRate(JSONObject output) {
		response = output.toString();
		
		currency = Currency.fromString(output.getString(Params.CURRENCY.toString()));
		rate = output.getDouble(Params.RATE.toString());
		
		if (output.containsKey(Params.SPLIT_COUNT.toString())) {
			splitCount = output.getInt(Params.SPLIT_COUNT.toString());
		}
		
		if (output.containsKey(Params.TOTAL_COST.toString())) {