
// currencies provides a list of currencies, and a way to retrieve information about them

package currencies

import "errors"

type CurrencyObject struct{

	// The name of the currency
	Name string

	// The three letter ISO code that is used to refer to the currency
	Code string

	// The symbol or abbreviation prefix for displaying the amount.
	// Example: $5, €6
	Symbol string
}

func VerifyCurrencyCode(currencyCode string)(bool, error){

	currencyObjectsMap, err := GetCurrencyObjectsMap()
	if (err != nil){ return false, err }

	_, exists := currencyObjectsMap[currencyCode]
	if (exists == true){
		return true, nil
	}

	return false, nil
}


var currencyObjectsMap map[string]CurrencyObject
var currencyObjectsList []CurrencyObject

func init(){

	initializeCurrencyObjectsList()

	// We initialize the currencyObjectsMap

	currencyObjectsMap = make(map[string]CurrencyObject)

	for _, currencyObject := range currencyObjectsList{
		
		currencyCode := currencyObject.Code
	
		currencyObjectsMap[currencyCode] = currencyObject
	}
}

//Outputs:
//	-string: Currency name
//	-string: Currency symbol
//	-error
func GetCurrencyInfoFromCurrencyCode(currencyCode string)(string, string, error){

	currencyObjectsMap, err := GetCurrencyObjectsMap()
	if (err != nil) { return "", "", err }

	currencyObject, exists := currencyObjectsMap[currencyCode]
	if (exists == false){
		return "", "", errors.New("GetCurrencyInfoFromCurrencyCode called with invalid currency code: " + currencyCode)
	}

	currencyName := currencyObject.Name
	currencySymbol := currencyObject.Symbol

	return currencyName, currencySymbol, nil
}

//Output:
//	-map[string]CurrencyObject: Currency Code -> Currency Object
//	-error
func GetCurrencyObjectsMap()(map[string]CurrencyObject, error){

	if (currencyObjectsMap == nil){
		return nil, errors.New("GetCurrencyObjectsMap called when currencyObjectsMap is not initialized.")
	}

	return currencyObjectsMap, nil
}

func GetCurrencyObjectsList()([]CurrencyObject, error){

	if (currencyObjectsList == nil){
		return nil, errors.New("GetCurrencyObjectsList called when currencyObjectsList is not initialized.")
	}

	return currencyObjectsList, nil
}


func initializeCurrencyObjectsList(){

	currencyObject_1 := CurrencyObject{
		Name: "US Dollar",
		Code: "USD",
		Symbol: "$",
	}
	currencyObject_2 := CurrencyObject{
		Name: "Canadian Dollar",
		Code: "CAD",
		Symbol: "CA$",
	}
	currencyObject_3 := CurrencyObject{
		Name: "Euro",
		Code: "EUR",
		Symbol: "€",
	}
	currencyObject_4 := CurrencyObject{
		Name: "United Arab Emirates Dirham",
		Code: "AED",
		Symbol: "AED",
	}
	currencyObject_5 := CurrencyObject{
		Name: "Afghan Afghani",
		Code: "AFN",
		Symbol: "Af",
	}
	currencyObject_6 := CurrencyObject{
		Name: "Albanian Lek",
		Code: "ALL",
		Symbol: "ALL",
	}
	currencyObject_7 := CurrencyObject{
		Name: "Armenian Dram",
		Code: "AMD",
		Symbol: "AMD",
	}
	currencyObject_8 := CurrencyObject{
		Name: "Argentine Peso",
		Code: "ARS",
		Symbol: "AR$",
	}
	currencyObject_9 := CurrencyObject{
		Name: "Australian Dollar",
		Code: "AUD",
		Symbol: "AU$",
	}
	currencyObject_10 := CurrencyObject{
		Name: "Azerbaijani Manat",
		Code: "AZN",
		Symbol: "₼",
	}
	currencyObject_11 := CurrencyObject{
		Name: "Bosnia and Herzegovina Convertible Mark",
		Code: "BAM",
		Symbol: "KM",
	}
	currencyObject_12 := CurrencyObject{
		Name: "Bangladeshi Taka",
		Code: "BDT",
		Symbol: "Tk",
	}
	currencyObject_13 := CurrencyObject{
		Name: "Bulgarian Lev",
		Code: "BGN",
		Symbol: "BGN",
	}
	currencyObject_14 := CurrencyObject{
		Name: "Bahraini Dinar",
		Code: "BHD",
		Symbol: "BD",
	}
	currencyObject_15 := CurrencyObject{
		Name: "Burundian Franc",
		Code: "BIF",
		Symbol: "FBu",
	}
	currencyObject_16 := CurrencyObject{
		Name: "Brunei Dollar",
		Code: "BND",
		Symbol: "BN$",
	}
	currencyObject_17 := CurrencyObject{
		Name: "Bolivian Boliviano",
		Code: "BOB",
		Symbol: "Bs",
	}
	currencyObject_18 := CurrencyObject{
		Name: "Brazilian Real",
		Code: "BRL",
		Symbol: "R$",
	}
	currencyObject_19 := CurrencyObject{
		Name: "Botswanan Pula",
		Code: "BWP",
		Symbol: "BWP",
	}
	currencyObject_20 := CurrencyObject{
		Name: "Belarusian Ruble",
		Code: "BYN",
		Symbol: "Br",
	}
	currencyObject_21 := CurrencyObject{
		Name: "Belize Dollar",
		Code: "BZD",
		Symbol: "BZ$",
	}
	currencyObject_22 := CurrencyObject{
		Name: "Congolese Franc",
		Code: "CDF",
		Symbol: "CDF",
	}
	currencyObject_23 := CurrencyObject{
		Name: "Swiss Franc",
		Code: "CHF",
		Symbol: "CHF",
	}
	currencyObject_24 := CurrencyObject{
		Name: "Chilean Peso",
		Code: "CLP",
		Symbol: "CL$",
	}
	currencyObject_25 := CurrencyObject{
		Name: "Chinese Yuan",
		Code: "CNY",
		Symbol: "CN¥",
	}
	currencyObject_26 := CurrencyObject{
		Name: "Colombian Peso",
		Code: "COP",
		Symbol: "CO$",
	}
	currencyObject_27 := CurrencyObject{
		Name: "Costa Rican Colón",
		Code: "CRC",
		Symbol: "₡",
	}
	currencyObject_28 := CurrencyObject{
		Name: "Cape Verdean Escudo",
		Code: "CVE",
		Symbol: "CV$",
	}
	currencyObject_29 := CurrencyObject{
		Name: "Czech Republic Koruna",
		Code: "CZK",
		Symbol: "Kč",
	}
	currencyObject_30 := CurrencyObject{
		Name: "Djiboutian Franc",
		Code: "DJF",
		Symbol: "Fr",
	}
	currencyObject_31 := CurrencyObject{
		Name: "Danish Krone",
		Code: "DKK",
		Symbol: "Dkr",
	}
	currencyObject_32 := CurrencyObject{
		Name: "Dominican Peso",
		Code: "DOP",
		Symbol: "RD$",
	}
	currencyObject_33 := CurrencyObject{
		Name: "Algerian Dinar",
		Code: "DZD",
		Symbol: "DA",
	}
	currencyObject_34 := CurrencyObject{
		Name: "Estonian Kroon",
		Code: "EEK",
		Symbol: "Ekr",
	}
	currencyObject_35 := CurrencyObject{
		Name: "Egyptian Pound",
		Code: "EGP",
		Symbol: "EGP",
	}
	currencyObject_36 := CurrencyObject{
		Name: "Eritrean Nakfa",
		Code: "ERN",
		Symbol: "Nfk",
	}
	currencyObject_37 := CurrencyObject{
		Name: "Ethiopian Birr",
		Code: "ETB",
		Symbol: "Br",
	}
	currencyObject_38 := CurrencyObject{
		Name: "British Pound Sterling",
		Code: "GBP",
		Symbol: "£",
	}
	currencyObject_39 := CurrencyObject{
		Name: "Georgian Lari",
		Code: "GEL",
		Symbol: "GEL",
	}
	currencyObject_40 := CurrencyObject{
		Name: "Ghanaian Cedi",
		Code: "GHS",
		Symbol: "GH₵",
	}
	currencyObject_41 := CurrencyObject{
		Name: "Guinean Franc",
		Code: "GNF",
		Symbol: "FG",
	}
	currencyObject_42 := CurrencyObject{
		Name: "Guatemalan Quetzal",
		Code: "GTQ",
		Symbol: "GTQ",
	}
	currencyObject_43 := CurrencyObject{
		Name: "Hong Kong Dollar",
		Code: "HKD",
		Symbol: "HK$",
	}
	currencyObject_44 := CurrencyObject{
		Name: "Honduran Lempira",
		Code: "HNL",
		Symbol: "HNL",
	}
	currencyObject_45 := CurrencyObject{
		Name: "Croatian Kuna",
		Code: "HRK",
		Symbol: "kn",
	}
	currencyObject_46 := CurrencyObject{
		Name: "Hungarian Forint",
		Code: "HUF",
		Symbol: "Ft",
	}
	currencyObject_47 := CurrencyObject{
		Name: "Indonesian Rupiah",
		Code: "IDR",
		Symbol: "Rp",
	}
	currencyObject_48 := CurrencyObject{
		Name: "Israeli New Sheqel",
		Code: "ILS",
		Symbol: "₪",
	}
	currencyObject_49 := CurrencyObject{
		Name: "Indian Rupee",
		Code: "INR",
		Symbol: "Rs",
	}
	currencyObject_50 := CurrencyObject{
		Name: "Iraqi Dinar",
		Code: "IQD",
		Symbol: "IQD",
	}
	currencyObject_51 := CurrencyObject{
		Name: "Iranian Rial",
		Code: "IRR",
		Symbol: "IRR",
	}
	currencyObject_52 := CurrencyObject{
		Name: "Icelandic Króna",
		Code: "ISK",
		Symbol: "Ikr",
	}
	currencyObject_53 := CurrencyObject{
		Name: "Jamaican Dollar",
		Code: "JMD",
		Symbol: "J$",
	}
	currencyObject_54 := CurrencyObject{
		Name: "Jordanian Dinar",
		Code: "JOD",
		Symbol: "JD",
	}
	currencyObject_55 := CurrencyObject{
		Name: "Japanese Yen",
		Code: "JPY",
		Symbol: "¥",
	}
	currencyObject_56 := CurrencyObject{
		Name: "Kenyan Shilling",
		Code: "KES",
		Symbol: "Ksh",
	}
	currencyObject_57 := CurrencyObject{
		Name: "Cambodian Riel",
		Code: "KHR",
		Symbol: "KHR",
	}
	currencyObject_58 := CurrencyObject{
		Name: "Comorian Franc",
		Code: "KMF",
		Symbol: "CF",
	}
	currencyObject_59 := CurrencyObject{
		Name: "South Korean Won",
		Code: "KRW",
		Symbol: "₩",
	}
	currencyObject_60 := CurrencyObject{
		Name: "Kuwaiti Dinar",
		Code: "KWD",
		Symbol: "KD",
	}
	currencyObject_61 := CurrencyObject{
		Name: "Kazakhstani Tenge",
		Code: "KZT",
		Symbol: "KZT",
	}
	currencyObject_62 := CurrencyObject{
		Name: "Lebanese Pound",
		Code: "LBP",
		Symbol: "LB£",
	}
	currencyObject_63 := CurrencyObject{
		Name: "Sri Lankan Rupee",
		Code: "LKR",
		Symbol: "SLRs",
	}
	currencyObject_64 := CurrencyObject{
		Name: "Lithuanian Litas",
		Code: "LTL",
		Symbol: "Lt",
	}
	currencyObject_65 := CurrencyObject{
		Name: "Latvian Lats",
		Code: "LVL",
		Symbol: "Ls",
	}
	currencyObject_66 := CurrencyObject{
		Name: "Libyan Dinar",
		Code: "LYD",
		Symbol: "LD",
	}
	currencyObject_67 := CurrencyObject{
		Name: "Moroccan Dirham",
		Code: "MAD",
		Symbol: "MAD",
	}
	currencyObject_68 := CurrencyObject{
		Name: "Moldovan Leu",
		Code: "MDL",
		Symbol: "MDL",
	}
	currencyObject_69 := CurrencyObject{
		Name: "Malagasy Ariary",
		Code: "MGA",
		Symbol: "MGA",
	}
	currencyObject_70 := CurrencyObject{
		Name: "Macedonian Denar",
		Code: "MKD",
		Symbol: "MKD",
	}
	currencyObject_71 := CurrencyObject{
		Name: "Myanma Kyat",
		Code: "MMK",
		Symbol: "MMK",
	}
	currencyObject_72 := CurrencyObject{
		Name: "Macanese Pataca",
		Code: "MOP",
		Symbol: "MOP$",
	}
	currencyObject_73 := CurrencyObject{
		Name: "Mauritian Rupee",
		Code: "MUR",
		Symbol: "MURs",
	}
	currencyObject_74 := CurrencyObject{
		Name: "Mexican Peso",
		Code: "MXN",
		Symbol: "MX$",
	}
	currencyObject_75 := CurrencyObject{
		Name: "Malaysian Ringgit",
		Code: "MYR",
		Symbol: "RM",
	}
	currencyObject_76 := CurrencyObject{
		Name: "Mozambican Metical",
		Code: "MZN",
		Symbol: "MTn",
	}
	currencyObject_77 := CurrencyObject{
		Name: "Namibian Dollar",
		Code: "NAD",
		Symbol: "N$",
	}
	currencyObject_78 := CurrencyObject{
		Name: "Nigerian Naira",
		Code: "NGN",
		Symbol: "₦",
	}
	currencyObject_79 := CurrencyObject{
		Name: "Nicaraguan Córdoba",
		Code: "NIO",
		Symbol: "C$",
	}
	currencyObject_80 := CurrencyObject{
		Name: "Norwegian Krone",
		Code: "NOK",
		Symbol: "Nkr",
	}
	currencyObject_81 := CurrencyObject{
		Name: "Nepalese Rupee",
		Code: "NPR",
		Symbol: "NPRs",
	}
	currencyObject_82 := CurrencyObject{
		Name: "New Zealand Dollar",
		Code: "NZD",
		Symbol: "NZ$",
	}
	currencyObject_83 := CurrencyObject{
		Name: "Omani Rial",
		Code: "OMR",
		Symbol: "OMR",
	}
	currencyObject_84 := CurrencyObject{
		Name: "Panamanian Balboa",
		Code: "PAB",
		Symbol: "B/",
	}
	currencyObject_85 := CurrencyObject{
		Name: "Peruvian Nuevo Sol",
		Code: "PEN",
		Symbol: "S/",
	}
	currencyObject_86 := CurrencyObject{
		Name: "Philippine Peso",
		Code: "PHP",
		Symbol: "₱",
	}
	currencyObject_87 := CurrencyObject{
		Name: "Pakistani Rupee",
		Code: "PKR",
		Symbol: "PKRs",
	}
	currencyObject_88 := CurrencyObject{
		Name: "Polish Zloty",
		Code: "PLN",
		Symbol: "zł",
	}
	currencyObject_89 := CurrencyObject{
		Name: "Paraguayan Guarani",
		Code: "PYG",
		Symbol: "₲",
	}
	currencyObject_90 := CurrencyObject{
		Name: "Qatari Rial",
		Code: "QAR",
		Symbol: "QR",
	}
	currencyObject_91 := CurrencyObject{
		Name: "Romanian Leu",
		Code: "RON",
		Symbol: "RON",
	}
	currencyObject_92 := CurrencyObject{
		Name: "Serbian Dinar",
		Code: "RSD",
		Symbol: "din",
	}
	currencyObject_93 := CurrencyObject{
		Name: "Russian Ruble",
		Code: "RUB",
		Symbol: "RUB",
	}
	currencyObject_94 := CurrencyObject{
		Name: "Rwandan Franc",
		Code: "RWF",
		Symbol: "RWF",
	}
	currencyObject_95 := CurrencyObject{
		Name: "Saudi Riyal",
		Code: "SAR",
		Symbol: "SR",
	}
	currencyObject_96 := CurrencyObject{
		Name: "Sudanese Pound",
		Code: "SDG",
		Symbol: "SDG",
	}
	currencyObject_97 := CurrencyObject{
		Name: "Swedish Krona",
		Code: "SEK",
		Symbol: "Skr",
	}
	currencyObject_98 := CurrencyObject{
		Name: "Singapore Dollar",
		Code: "SGD",
		Symbol: "S$",
	}
	currencyObject_99 := CurrencyObject{
		Name: "Somali Shilling",
		Code: "SOS",
		Symbol: "Ssh",
	}
	currencyObject_100 := CurrencyObject{
		Name: "Syrian Pound",
		Code: "SYP",
		Symbol: "SY£",
	}
	currencyObject_101 := CurrencyObject{
		Name: "Thai Baht",
		Code: "THB",
		Symbol: "฿",
	}
	currencyObject_102 := CurrencyObject{
		Name: "Tunisian Dinar",
		Code: "TND",
		Symbol: "DT",
	}
	currencyObject_103 := CurrencyObject{
		Name: "Tongan Paʻanga",
		Code: "TOP",
		Symbol: "T$",
	}
	currencyObject_104 := CurrencyObject{
		Name: "Turkish Lira",
		Code: "TRY",
		Symbol: "TL",
	}
	currencyObject_105 := CurrencyObject{
		Name: "Trinidad and Tobago Dollar",
		Code: "TTD",
		Symbol: "TT$",
	}
	currencyObject_106 := CurrencyObject{
		Name: "New Taiwan Dollar",
		Code: "TWD",
		Symbol: "NT$",
	}
	currencyObject_107 := CurrencyObject{
		Name: "Tanzanian Shilling",
		Code: "TZS",
		Symbol: "TSh",
	}
	currencyObject_108 := CurrencyObject{
		Name: "Ukrainian Hryvnia",
		Code: "UAH",
		Symbol: "₴",
	}
	currencyObject_109 := CurrencyObject{
		Name: "Ugandan Shilling",
		Code: "UGX",
		Symbol: "USh",
	}
	currencyObject_110 := CurrencyObject{
		Name: "Uruguayan Peso",
		Code: "UYU",
		Symbol: "$U",
	}
	currencyObject_111 := CurrencyObject{
		Name: "Uzbekistan Som",
		Code: "UZS",
		Symbol: "UZS",
	}
	currencyObject_112 := CurrencyObject{
		Name: "Venezuelan Bolívar",
		Code: "VES",
		Symbol: "Bs.S.",
	}
	currencyObject_113 := CurrencyObject{
		Name: "Vietnamese Dong",
		Code: "VND",
		Symbol: "₫",
	}
	currencyObject_114 := CurrencyObject{
		Name: "Central African CFA Franc",
		Code: "XAF",
		Symbol: "Fr",
	}
	currencyObject_115 := CurrencyObject{
		Name: "West African CFA Franc",
		Code: "XOF",
		Symbol: "Fr",
	}
	currencyObject_116 := CurrencyObject{
		Name: "Yemeni Rial",
		Code: "YER",
		Symbol: "YR",
	}
	currencyObject_117 := CurrencyObject{
		Name: "South African Rand",
		Code: "ZAR",
		Symbol: "R",
	}
	currencyObject_118 := CurrencyObject{
		Name: "Zambian Kwacha",
		Code: "ZMK",
		Symbol: "ZK",
	}
	currencyObject_119 := CurrencyObject{
		Name: "Zimbabwean Dollar",
		Code: "ZWL",
		Symbol: "ZWL$",
	}

	currencyObject_120 := CurrencyObject{
		Name: "Ethereum",
		Code: "ETH",
		Symbol: "ETH",
	}

	currencyObject_121 := CurrencyObject{
		Name: "Cardano",
		Code: "ADA",
		Symbol: "ADA",
	}

	currencyObjectsList = []CurrencyObject{currencyObject_1, currencyObject_2, currencyObject_3, currencyObject_4, currencyObject_5, currencyObject_6, currencyObject_7, currencyObject_8, currencyObject_9, currencyObject_10, currencyObject_11, currencyObject_12, currencyObject_13, currencyObject_14, currencyObject_15, currencyObject_16, currencyObject_17, currencyObject_18, currencyObject_19, currencyObject_20, currencyObject_21, currencyObject_22, currencyObject_23, currencyObject_24, currencyObject_25, currencyObject_26, currencyObject_27, currencyObject_28, currencyObject_29, currencyObject_30, currencyObject_31, currencyObject_32, currencyObject_33, currencyObject_34, currencyObject_35, currencyObject_36, currencyObject_37, currencyObject_38, currencyObject_39, currencyObject_40, currencyObject_41, currencyObject_42, currencyObject_43, currencyObject_44, currencyObject_45, currencyObject_46, currencyObject_47, currencyObject_48, currencyObject_49, currencyObject_50, currencyObject_51, currencyObject_52, currencyObject_53, currencyObject_54, currencyObject_55, currencyObject_56, currencyObject_57, currencyObject_58, currencyObject_59, currencyObject_60, currencyObject_61, currencyObject_62, currencyObject_63, currencyObject_64, currencyObject_65, currencyObject_66, currencyObject_67, currencyObject_68, currencyObject_69, currencyObject_70, currencyObject_71, currencyObject_72, currencyObject_73, currencyObject_74, currencyObject_75, currencyObject_76, currencyObject_77, currencyObject_78, currencyObject_79, currencyObject_80, currencyObject_81, currencyObject_82, currencyObject_83, currencyObject_84, currencyObject_85, currencyObject_86, currencyObject_87, currencyObject_88, currencyObject_89, currencyObject_90, currencyObject_91, currencyObject_92, currencyObject_93, currencyObject_94, currencyObject_95, currencyObject_96, currencyObject_97, currencyObject_98, currencyObject_99, currencyObject_100, currencyObject_101, currencyObject_102, currencyObject_103, currencyObject_104, currencyObject_105, currencyObject_106, currencyObject_107, currencyObject_108, currencyObject_109, currencyObject_110, currencyObject_111, currencyObject_112, currencyObject_113, currencyObject_114, currencyObject_115, currencyObject_116, currencyObject_117, currencyObject_118, currencyObject_119, currencyObject_120, currencyObject_121}

}


