<?php
/**
 * Currencies helper functions.
 *
 * @package Awesomemotive\Rewardswp\Helpers
 * @since 1.0.0
 */

namespace Awesomemotive\Rewardswp\Helpers;

if ( ! defined( 'ABSPATH' ) ) {
	exit;
}

use Awesomemotive\Rewardswp\Settings\Options\General\CurrencyOption;

/**
 * Retrieve the site currency.
 *
 * @since 1.0.0
 *
 * @return string
 */
function get_site_currency(): string {
	return get_option_value( CurrencyOption::class );
}

/**
 * Retrieve the site currency array with the name and symbol.
 *
 * @since 1.0.0
 *
 * @return array
 */
function get_site_currency_data(): array {
	return get_currency(
		get_option_value( CurrencyOption::class )
	);
}

/**
 * Retrieve the site currency symbol.
 *
 * @since 1.0.0
 *
 * @return string
 */
function get_site_currency_symbol(): string {
	$site_currency = get_site_currency_data();

	if ( empty( $site_currency ) ) {
		return '';
	}

	return $site_currency['symbol'];
}

/**
 * Retrieve a single currency name and symbol.
 *
 * @since 1.0.0
 *
 * @param string $currency The currency to retrieve data.
 *
 * @return array The currency data.
 */
function get_currency( string $currency ): array {
	$currencies = get_currencies();

	return $currencies[ $currency ] ?? [];
}

/**
 * Format a monetary value with currency symbol.
 *
 * Formats the value according to currency conventions:
 * - Uses the site currency symbol by default
 * - Hides decimals when they are .00 (configurable)
 * - Uses proper decimal and thousands separators
 *
 * @since 1.1.0
 *
 * @param float  $amount              The monetary amount to format.
 * @param string $currency_code       Optional. Currency code (e.g., 'USD', 'EUR'). Defaults to site currency.
 * @param bool   $hide_zero_decimals  Optional. Whether to hide .00 decimals. Default true.
 * @param bool   $include_symbol      Optional. Whether to include the currency symbol. Default true.
 *
 * @return string The formatted currency string (e.g., "$500", "€100,50", "R$1.000").
 */
function format_currency( float $amount, string $currency_code = '', bool $hide_zero_decimals = true, bool $include_symbol = true ): string {
	// Use site currency if not specified.
	if ( empty( $currency_code ) ) {
		$currency_code = get_site_currency();
	}

	$currency_data = get_currency( $currency_code );
	$symbol        = $currency_data['symbol'] ?? '$';

	// Get currency format settings.
	$format = get_currency_format( $currency_code );

	// Determine decimals: hide if .00 and hide_zero_decimals is true.
	$decimals = $format['decimals'];
	if ( $hide_zero_decimals && floor( $amount ) === $amount ) {
		$decimals = 0;
	}

	// Format the number.
	$formatted_amount = number_format(
		$amount,
		$decimals,
		$format['decimal_separator'],
		$format['thousands_separator']
	);

	if ( ! $include_symbol ) {
		return $formatted_amount;
	}

	return apply_currency_symbol( $symbol, $formatted_amount, $currency_code );
}

/**
 * Assemble a currency symbol and a pre-formatted amount into a display string.
 *
 * Places the symbol before or after the amount according to the resolved currency
 * position (see get_currency_position()) and inserts a non-breaking space when the
 * convention calls for one, e.g. "5 €" for euro stores versus "$5" for dollar stores.
 *
 * @since 1.4.4
 *
 * @param string $symbol           The currency symbol (e.g. "€", "$").
 * @param string $formatted_amount The already number-formatted amount, without a symbol.
 * @param string $currency_code    Optional. Currency code used to resolve position. Defaults to site currency.
 *
 * @return string The assembled string (e.g. "$5", "5 €").
 */
function apply_currency_symbol( string $symbol, string $formatted_amount, string $currency_code = '' ): string {
	$position  = get_currency_position( $currency_code );
	$separator = $position['space'] ? "\u{00A0}" : ''; // Non-breaking space keeps "5 €" together on one line.

	if ( 'after' === $position['position'] ) {
		return $formatted_amount . $separator . $symbol;
	}

	return $symbol . $separator . $formatted_amount;
}

/**
 * Build a JavaScript concatenation expression that joins a symbol and an amount in the store's order.
 *
 * The symbol position is a page-level constant resolved server-side (see get_currency_position()),
 * but the amount often lives in a client-side variable (an Alpine x-text binding, a reactive admin
 * preview, etc.). This emits the correctly-ordered JS so the position decision stays entirely in PHP
 * without shipping a separate client-side formatter.
 *
 * Example: js_money_expr( 'reward.amount' ) yields "currencySymbol + reward.amount" for a leading
 * symbol, or "reward.amount + ' ' + currencySymbol" for a trailing symbol with a space.
 *
 * @since 1.4.4
 *
 * @param string $amount_js JS expression that evaluates to the amount (e.g. 'reward.minimum_order_amount').
 * @param string $symbol_js JS expression that evaluates to the symbol. Defaults to the 'currencySymbol'
 *                          identifier; pass a quoted literal (e.g. "'€'") or 'window.currencySymbol' as needed.
 *
 * @return string A JS expression joining symbol and amount in the resolved order.
 */
function js_money_expr( string $amount_js, string $symbol_js = 'currencySymbol' ): string {
	$position  = get_currency_position();
	$separator = $position['space'] ? " + '\\u00A0' + " : ' + ';

	if ( 'after' === $position['position'] ) {
		return $amount_js . $separator . $symbol_js;
	}

	return $symbol_js . $separator . $amount_js;
}

/**
 * Determine where the currency symbol should sit relative to the amount.
 *
 * Resolution order, most authoritative first:
 *  1. WooCommerce's `woocommerce_currency_pos` setting - the merchant's explicit choice.
 *  2. Easy Digital Downloads' `currency_position` setting.
 *  3. A locale-style default derived from the currency code (see get_default_currency_position()).
 *
 * The store platform's setting wins because a merchant may deliberately differ from the
 * locale default (for example, a euro store that prefers a leading symbol for brand reasons).
 * We only guess from the currency code when no store platform is present to ask.
 *
 * @since 1.4.4
 *
 * @param string $currency_code Optional. Currency code. Defaults to site currency.
 *
 * @return array {
 *     Resolved symbol placement.
 *
 *     @type string $position Either 'before' or 'after'.
 *     @type bool   $space    Whether to separate symbol and amount with a non-breaking space.
 * }
 */
function get_currency_position( string $currency_code = '' ): array {
	if ( empty( $currency_code ) ) {
		$currency_code = get_site_currency();
	}

	// 1. WooCommerce stores both the side and whether a space is used.
	if ( function_exists( 'get_woocommerce_currency' ) ) {
		$wc_map = [
			'left'        => [ 'position' => 'before', 'space' => false ],
			'right'       => [ 'position' => 'after',  'space' => false ],
			'left_space'  => [ 'position' => 'before', 'space' => true ],
			'right_space' => [ 'position' => 'after',  'space' => true ],
		];

		$wc_pos = get_option( 'woocommerce_currency_pos' );
		if ( isset( $wc_map[ $wc_pos ] ) ) {
			return $wc_map[ $wc_pos ];
		}
	}

	// 2. EDD stores only the side; keep the locale's spacing convention.
	if ( function_exists( 'edd_get_option' ) ) {
		$edd_pos = edd_get_option( 'currency_position', '' );
		if ( in_array( $edd_pos, [ 'before', 'after' ], true ) ) {
			$resolved             = get_default_currency_position( $currency_code );
			$resolved['position'] = $edd_pos;
			return $resolved;
		}
	}

	// 3. No store platform to ask - guess from the currency code.
	return get_default_currency_position( $currency_code );
}

/**
 * Locale-style fallback for currency symbol placement, derived from the currency code.
 *
 * Used only when neither WooCommerce nor EDD is available to provide the merchant's
 * configured position. Most eurozone and Northern/Eastern European currencies place
 * the symbol after the amount with a space ("5 €"); everything else defaults to a
 * leading symbol with no space ("$5").
 *
 * @since 1.4.4
 *
 * @param string $currency_code Optional. Currency code. Defaults to site currency.
 *
 * @return array {
 *     Resolved symbol placement.
 *
 *     @type string $position Either 'before' or 'after'.
 *     @type bool   $space    Whether to separate symbol and amount with a non-breaking space.
 * }
 */
function get_default_currency_position( string $currency_code = '' ): array {
	if ( empty( $currency_code ) ) {
		$currency_code = get_site_currency();
	}

	// Currencies that conventionally place the symbol after the amount, with a space.
	$symbol_after_currencies = [
		'EUR', // Euro (France, Germany, Spain, Italy, and most of the eurozone).
		'PLN', // Polish Zloty.
		'CZK', // Czech Koruna.
		'HUF', // Hungarian Forint.
		'RON', // Romanian Leu.
		'RSD', // Serbian Dinar.
		'SEK', // Swedish Krona.
		'NOK', // Norwegian Krone.
		'DKK', // Danish Krone.
		'ISK', // Icelandic Krona.
		'HRK', // Croatian Kuna.
		'BGN', // Bulgarian Lev.
		'UAH', // Ukrainian Hryvnia.
		'RUB', // Russian Ruble.
	];

	if ( in_array( $currency_code, $symbol_after_currencies, true ) ) {
		return [
			'position' => 'after',
			'space'    => true,
		];
	}

	return [
		'position' => 'before',
		'space'    => false,
	];
}

/**
 * Get currency format settings (decimal separator, thousands separator, decimals).
 *
 * Different currencies use different formatting conventions:
 * - US/UK: $1,000.00 (comma for thousands, dot for decimals)
 * - Europe: €1.000,00 (dot for thousands, comma for decimals)
 * - Some currencies have no decimals (JPY, KRW, etc.)
 *
 * @since 1.1.0
 *
 * @param string $currency_code The currency code.
 *
 * @return array {
 *     Format settings for the currency.
 *
 *     @type string $decimal_separator   Character for decimal point.
 *     @type string $thousands_separator Character for thousands grouping.
 *     @type int    $decimals            Number of decimal places.
 * }
 */
function get_currency_format( string $currency_code ): array {
	// Currencies with no decimal places.
	$zero_decimal_currencies = [
		'JPY', // Japanese Yen.
		'KRW', // South Korean Won.
		'VND', // Vietnamese Dong.
		'IDR', // Indonesian Rupiah.
		'CLP', // Chilean Peso.
		'PYG', // Paraguayan Guarani.
		'UGX', // Ugandan Shilling.
		'RWF', // Rwandan Franc.
		'GNF', // Guinean Franc.
		'KMF', // Comorian Franc.
		'XAF', // CFA Franc BEAC.
		'XOF', // CFA Franc BCEAO.
		'XPF', // CFP Franc.
		'VUV', // Vanuatu Vatu.
		'DJF', // Djiboutian Franc.
		'BIF', // Burundian Franc.
	];

	// Currencies that use comma as decimal separator (European style).
	$comma_decimal_currencies = [
		'EUR', // Euro.
		'BRL', // Brazilian Real.
		'ARS', // Argentine Peso.
		'COP', // Colombian Peso.
		'CLP', // Chilean Peso.
		'PEN', // Peruvian Sol.
		'VES', // Venezuelan Bolívar.
		'BOB', // Bolivian Boliviano.
		'PYG', // Paraguayan Guarani.
		'UYU', // Uruguayan Peso.
		'PLN', // Polish Zloty.
		'CZK', // Czech Koruna.
		'HUF', // Hungarian Forint.
		'RON', // Romanian Leu.
		'RSD', // Serbian Dinar.
		'TRY', // Turkish Lira.
		'RUB', // Russian Ruble.
		'UAH', // Ukrainian Hryvnia.
		'NOK', // Norwegian Krone.
		'SEK', // Swedish Krona.
		'DKK', // Danish Krone.
		'ISK', // Icelandic Króna.
		'IDR', // Indonesian Rupiah.
		'VND', // Vietnamese Dong.
	];

	// Determine decimals.
	$decimals = in_array( $currency_code, $zero_decimal_currencies, true ) ? 0 : 2;

	// Determine separators.
	if ( in_array( $currency_code, $comma_decimal_currencies, true ) ) {
		return [
			'decimal_separator'   => ',',
			'thousands_separator' => '.',
			'decimals'            => $decimals,
		];
	}

	// Default: US/UK style.
	return [
		'decimal_separator'   => '.',
		'thousands_separator' => ',',
		'decimals'            => $decimals,
	];
}

/**
 * Check if a currency is a zero-decimal currency.
 *
 * Zero-decimal currencies don't use fractional units (no cents).
 * Examples: JPY (Yen), KRW (Won), VND (Dong).
 *
 * @since 1.3.0
 *
 * @param string $currency_code The currency code to check.
 *
 * @return bool True if the currency is zero-decimal.
 */
function is_zero_decimal_currency( string $currency_code ): bool {
	$zero_decimal_currencies = [
		'JPY', // Japanese Yen.
		'KRW', // South Korean Won.
		'VND', // Vietnamese Dong.
		'IDR', // Indonesian Rupiah.
		'CLP', // Chilean Peso.
		'PYG', // Paraguayan Guarani.
		'UGX', // Ugandan Shilling.
		'RWF', // Rwandan Franc.
		'GNF', // Guinean Franc.
		'KMF', // Comorian Franc.
		'XAF', // CFA Franc BEAC.
		'XOF', // CFA Franc BCEAO.
		'XPF', // CFP Franc.
		'VUV', // Vanuatu Vatu.
		'DJF', // Djiboutian Franc.
		'BIF', // Burundian Franc.
	];

	return in_array( $currency_code, $zero_decimal_currencies, true );
}

/**
 * Get the default base amount for points calculation based on currency.
 *
 * For zero-decimal currencies (JPY, KRW, etc.), returns 100 as the default
 * since merchants typically think in units of 100 (e.g., ¥100 ≈ $1).
 * For standard currencies, returns 1.
 *
 * @since 1.3.0
 *
 * @param string $currency_code Optional. The currency code. Defaults to site currency.
 *
 * @return int Default base amount (1 for standard currencies, 100 for zero-decimal).
 */
function get_default_points_base_amount( string $currency_code = '' ): int {
	if ( empty( $currency_code ) ) {
		$currency_code = get_site_currency();
	}

	return is_zero_decimal_currency( $currency_code ) ? 100 : 1;
}

/**
 * Retrieve all supported currencies.
 *
 * @since 1.0.0
 *
 * @return array[] An array containing all supported currencies.
 */
function get_currencies(): array {
	return [
		'USD' => [
			'name'   => __( 'United States Dollar', 'rewardswp' ),
			'symbol' => '$',
		],
		'EUR' => [
			'name'   => __( 'Euro', 'rewardswp' ),
			'symbol' => '€',
		],
		'JPY' => [
			'name'   => __( 'Japanese Yen', 'rewardswp' ),
			'symbol' => '¥',
		],
		'GBP' => [
			'name'   => __( 'British Pound Sterling', 'rewardswp' ),
			'symbol' => '£',
		],
		'AUD' => [
			'name'   => __( 'Australian Dollar', 'rewardswp' ),
			'symbol' => 'A$',
		],
		'CAD' => [
			'name'   => __( 'Canadian Dollar', 'rewardswp' ),
			'symbol' => 'C$',
		],
		'CHF' => [
			'name'   => __( 'Swiss Franc', 'rewardswp' ),
			'symbol' => 'CHF',
		],
		'CNY' => [
			'name'   => __( 'Chinese Yuan', 'rewardswp' ),
			'symbol' => '¥',
		],
		'SEK' => [
			'name'   => __( 'Swedish Krona', 'rewardswp' ),
			'symbol' => 'kr',
		],
		'NZD' => [
			'name'   => __( 'New Zealand Dollar', 'rewardswp' ),
			'symbol' => 'NZ$',
		],
		'MXN' => [
			'name'   => __( 'Mexican Peso', 'rewardswp' ),
			'symbol' => '$',
		],
		'SGD' => [
			'name'   => __( 'Singapore Dollar', 'rewardswp' ),
			'symbol' => 'S$',
		],
		'HKD' => [
			'name'   => __( 'Hong Kong Dollar', 'rewardswp' ),
			'symbol' => 'HK$',
		],
		'NOK' => [
			'name'   => __( 'Norwegian Krone', 'rewardswp' ),
			'symbol' => 'kr',
		],
		'KRW' => [
			'name'   => __( 'South Korean Won', 'rewardswp' ),
			'symbol' => '₩',
		],
		'TRY' => [
			'name'   => __( 'Turkish Lira', 'rewardswp' ),
			'symbol' => '₺',
		],
		'RUB' => [
			'name'   => __( 'Russian Ruble', 'rewardswp' ),
			'symbol' => '₽',
		],
		'INR' => [
			'name'   => __( 'Indian Rupee', 'rewardswp' ),
			'symbol' => '₹',
		],
		'BRL' => [
			'name'   => __( 'Brazilian Real', 'rewardswp' ),
			'symbol' => 'R$',
		],
		'ZAR' => [
			'name'   => __( 'South African Rand', 'rewardswp' ),
			'symbol' => 'R',
		],
		'AED' => [
			'name'   => __( 'United Arab Emirates Dirham', 'rewardswp' ),
			'symbol' => 'د.إ',
		],
		'AFN' => [
			'name'   => __( 'Afghan Afghani', 'rewardswp' ),
			'symbol' => '؋',
		],
		'ALL' => [
			'name'   => __( 'Albanian Lek', 'rewardswp' ),
			'symbol' => 'L',
		],
		'AMD' => [
			'name'   => __( 'Armenian Dram', 'rewardswp' ),
			'symbol' => '֏',
		],
		'ANG' => [
			'name'   => __( 'Netherlands Antillean Guilder', 'rewardswp' ),
			'symbol' => 'ƒ',
		],
		'AOA' => [
			'name'   => __( 'Angolan Kwanza', 'rewardswp' ),
			'symbol' => 'Kz',
		],
		'ARS' => [
			'name'   => __( 'Argentine Peso', 'rewardswp' ),
			'symbol' => '$',
		],
		'AWG' => [
			'name'   => __( 'Aruban Florin', 'rewardswp' ),
			'symbol' => 'ƒ',
		],
		'AZN' => [
			'name'   => __( 'Azerbaijani Manat', 'rewardswp' ),
			'symbol' => '₼',
		],
		'BAM' => [
			'name'   => __( 'Bosnia-Herzegovina Convertible Mark', 'rewardswp' ),
			'symbol' => 'KM',
		],
		'BBD' => [
			'name'   => __( 'Barbadian Dollar', 'rewardswp' ),
			'symbol' => '$',
		],
		'BDT' => [
			'name'   => __( 'Bangladeshi Taka', 'rewardswp' ),
			'symbol' => '৳',
		],
		'BGN' => [
			'name'   => __( 'Bulgarian Lev', 'rewardswp' ),
			'symbol' => 'лв',
		],
		'BHD' => [
			'name'   => __( 'Bahraini Dinar', 'rewardswp' ),
			'symbol' => '.د.ب',
		],
		'BIF' => [
			'name'   => __( 'Burundian Franc', 'rewardswp' ),
			'symbol' => 'FBu',
		],
		'BMD' => [
			'name'   => __( 'Bermudan Dollar', 'rewardswp' ),
			'symbol' => '$',
		],
		'BND' => [
			'name'   => __( 'Brunei Dollar', 'rewardswp' ),
			'symbol' => '$',
		],
		'BOB' => [
			'name'   => __( 'Bolivian Boliviano', 'rewardswp' ),
			'symbol' => 'Bs.',
		],
		'BSD' => [
			'name'   => __( 'Bahamian Dollar', 'rewardswp' ),
			'symbol' => '$',
		],
		'BTN' => [
			'name'   => __( 'Bhutanese Ngultrum', 'rewardswp' ),
			'symbol' => 'Nu.',
		],
		'BWP' => [
			'name'   => __( 'Botswanan Pula', 'rewardswp' ),
			'symbol' => 'P',
		],
		'BYN' => [
			'name'   => __( 'Belarusian Ruble', 'rewardswp' ),
			'symbol' => 'Br',
		],
		'BZD' => [
			'name'   => __( 'Belize Dollar', 'rewardswp' ),
			'symbol' => 'BZ$',
		],
		'CDF' => [
			'name'   => __( 'Congolese Franc', 'rewardswp' ),
			'symbol' => 'FC',
		],
		'CLF' => [
			'name'   => __( 'Chilean Unit of Account (UF)', 'rewardswp' ),
			'symbol' => 'UF',
		],
		'CLP' => [
			'name'   => __( 'Chilean Peso', 'rewardswp' ),
			'symbol' => '$',
		],
		'COP' => [
			'name'   => __( 'Colombian Peso', 'rewardswp' ),
			'symbol' => '$',
		],
		'CRC' => [
			'name'   => __( 'Costa Rican Colón', 'rewardswp' ),
			'symbol' => '₡',
		],
		'CUC' => [
			'name'   => __( 'Cuban Convertible Peso', 'rewardswp' ),
			'symbol' => '$',
		],
		'CUP' => [
			'name'   => __( 'Cuban Peso', 'rewardswp' ),
			'symbol' => '₱',
		],
		'CVE' => [
			'name'   => __( 'Cape Verdean Escudo', 'rewardswp' ),
			'symbol' => '$',
		],
		'CZK' => [
			'name'   => __( 'Czech Republic Koruna', 'rewardswp' ),
			'symbol' => 'Kč',
		],
		'DJF' => [
			'name'   => __( 'Djiboutian Franc', 'rewardswp' ),
			'symbol' => 'Fdj',
		],
		'DKK' => [
			'name'   => __( 'Danish Krone', 'rewardswp' ),
			'symbol' => 'kr',
		],
		'DOP' => [
			'name'   => __( 'Dominican Peso', 'rewardswp' ),
			'symbol' => 'RD$',
		],
		'DZD' => [
			'name'   => __( 'Algerian Dinar', 'rewardswp' ),
			'symbol' => 'د.ج',
		],
		'EGP' => [
			'name'   => __( 'Egyptian Pound', 'rewardswp' ),
			'symbol' => '£',
		],
		'ERN' => [
			'name'   => __( 'Eritrean Nakfa', 'rewardswp' ),
			'symbol' => 'Nfk',
		],
		'ETB' => [
			'name'   => __( 'Ethiopian Birr', 'rewardswp' ),
			'symbol' => 'Br',
		],
		'FJD' => [
			'name'   => __( 'Fijian Dollar', 'rewardswp' ),
			'symbol' => '$',
		],
		'FKP' => [
			'name'   => __( 'Falkland Islands Pound', 'rewardswp' ),
			'symbol' => '£',
		],
		'GEL' => [
			'name'   => __( 'Georgian Lari', 'rewardswp' ),
			'symbol' => '₾',
		],
		'GGP' => [
			'name'   => __( 'Guernsey Pound', 'rewardswp' ),
			'symbol' => '£',
		],
		'GHS' => [
			'name'   => __( 'Ghanaian Cedi', 'rewardswp' ),
			'symbol' => '₵',
		],
		'GIP' => [
			'name'   => __( 'Gibraltar Pound', 'rewardswp' ),
			'symbol' => '£',
		],
		'GMD' => [
			'name'   => __( 'Gambian Dalasi', 'rewardswp' ),
			'symbol' => 'D',
		],
		'GNF' => [
			'name'   => __( 'Guinean Franc', 'rewardswp' ),
			'symbol' => 'FG',
		],
		'GTQ' => [
			'name'   => __( 'Guatemalan Quetzal', 'rewardswp' ),
			'symbol' => 'Q',
		],
		'GYD' => [
			'name'   => __( 'Guyanaese Dollar', 'rewardswp' ),
			'symbol' => '$',
		],
		'HNL' => [
			'name'   => __( 'Honduran Lempira', 'rewardswp' ),
			'symbol' => 'L',
		],
		'HRK' => [
			'name'   => __( 'Croatian Kuna', 'rewardswp' ),
			'symbol' => 'kn',
		],
		'HTG' => [
			'name'   => __( 'Haitian Gourde', 'rewardswp' ),
			'symbol' => 'G',
		],
		'HUF' => [
			'name'   => __( 'Hungarian Forint', 'rewardswp' ),
			'symbol' => 'Ft',
		],
		'IDR' => [
			'name'   => __( 'Indonesian Rupiah', 'rewardswp' ),
			'symbol' => 'Rp',
		],
		'ILS' => [
			'name'   => __( 'Israeli New Sheqel', 'rewardswp' ),
			'symbol' => '₪',
		],
		'IMP' => [
			'name'   => __( 'Manx pound', 'rewardswp' ),
			'symbol' => '£',
		],
		'IQD' => [
			'name'   => __( 'Iraqi Dinar', 'rewardswp' ),
			'symbol' => 'ع.د',
		],
		'IRR' => [
			'name'   => __( 'Iranian Rial', 'rewardswp' ),
			'symbol' => '﷼',
		],
		'ISK' => [
			'name'   => __( 'Icelandic Króna', 'rewardswp' ),
			'symbol' => 'kr',
		],
		'JEP' => [
			'name'   => __( 'Jersey Pound', 'rewardswp' ),
			'symbol' => '£',
		],
		'JMD' => [
			'name'   => __( 'Jamaican Dollar', 'rewardswp' ),
			'symbol' => 'J$',
		],
		'JOD' => [
			'name'   => __( 'Jordanian Dinar', 'rewardswp' ),
			'symbol' => 'د.ا',
		],
		'KES' => [
			'name'   => __( 'Kenyan Shilling', 'rewardswp' ),
			'symbol' => 'KSh',
		],
		'KGS' => [
			'name'   => __( 'Kyrgystani Som', 'rewardswp' ),
			'symbol' => 'лв',
		],
		'KHR' => [
			'name'   => __( 'Cambodian Riel', 'rewardswp' ),
			'symbol' => '៛',
		],
		'KMF' => [
			'name'   => __( 'Comorian Franc', 'rewardswp' ),
			'symbol' => 'CF',
		],
		'KPW' => [
			'name'   => __( 'North Korean Won', 'rewardswp' ),
			'symbol' => '₩',
		],
		'KWD' => [
			'name'   => __( 'Kuwaiti Dinar', 'rewardswp' ),
			'symbol' => 'د.ك',
		],
		'KYD' => [
			'name'   => __( 'Cayman Islands Dollar', 'rewardswp' ),
			'symbol' => '$',
		],
		'KZT' => [
			'name'   => __( 'Kazakhstani Tenge', 'rewardswp' ),
			'symbol' => '₸',
		],
		'LAK' => [
			'name'   => __( 'Laotian Kip', 'rewardswp' ),
			'symbol' => '₭',
		],
		'LBP' => [
			'name'   => __( 'Lebanese Pound', 'rewardswp' ),
			'symbol' => 'ل.ل',
		],
		'LKR' => [
			'name'   => __( 'Sri Lankan Rupee', 'rewardswp' ),
			'symbol' => '₨',
		],
		'LRD' => [
			'name'   => __( 'Liberian Dollar', 'rewardswp' ),
			'symbol' => '$',
		],
		'LSL' => [
			'name'   => __( 'Lesotho Loti', 'rewardswp' ),
			'symbol' => 'L',
		],
		'LYD' => [
			'name'   => __( 'Libyan Dinar', 'rewardswp' ),
			'symbol' => 'ل.د',
		],
		'MAD' => [
			'name'   => __( 'Moroccan Dirham', 'rewardswp' ),
			'symbol' => 'د.م.',
		],
		'MDL' => [
			'name'   => __( 'Moldovan Leu', 'rewardswp' ),
			'symbol' => 'L',
		],
		'MGA' => [
			'name'   => __( 'Malagasy Ariary', 'rewardswp' ),
			'symbol' => 'Ar',
		],
		'MKD' => [
			'name'   => __( 'Macedonian Denar', 'rewardswp' ),
			'symbol' => 'ден',
		],
		'MMK' => [
			'name'   => __( 'Myanma Kyat', 'rewardswp' ),
			'symbol' => 'Ks',
		],
		'MNT' => [
			'name'   => __( 'Mongolian Tugrik', 'rewardswp' ),
			'symbol' => '₮',
		],
		'MOP' => [
			'name'   => __( 'Macanese Pataca', 'rewardswp' ),
			'symbol' => 'P',
		],
		'MRU' => [
			'name'   => __( 'Mauritanian Ouguiya', 'rewardswp' ),
			'symbol' => 'UM',
		],
		'MUR' => [
			'name'   => __( 'Mauritian Rupee', 'rewardswp' ),
			'symbol' => '₨',
		],
		'MVR' => [
			'name'   => __( 'Maldivian Rufiyaa', 'rewardswp' ),
			'symbol' => '.ރ',
		],
		'MWK' => [
			'name'   => __( 'Malawian Kwacha', 'rewardswp' ),
			'symbol' => 'MK',
		],
		'MYR' => [
			'name'   => __( 'Malaysian Ringgit', 'rewardswp' ),
			'symbol' => 'RM',
		],
		'MZN' => [
			'name'   => __( 'Mozambican Metical', 'rewardswp' ),
			'symbol' => 'MT',
		],
		'NAD' => [
			'name'   => __( 'Namibian Dollar', 'rewardswp' ),
			'symbol' => '$',
		],
		'NGN' => [
			'name'   => __( 'Nigerian Naira', 'rewardswp' ),
			'symbol' => '₦',
		],
		'NIO' => [
			'name'   => __( 'Nicaraguan Córdoba', 'rewardswp' ),
			'symbol' => 'C$',
		],
		'NPR' => [
			'name'   => __( 'Nepalese Rupee', 'rewardswp' ),
			'symbol' => '₨',
		],
		'OMR' => [
			'name'   => __( 'Omani Rial', 'rewardswp' ),
			'symbol' => '﷼',
		],
		'PAB' => [
			'name'   => __( 'Panamanian Balboa', 'rewardswp' ),
			'symbol' => 'B/.',
		],
		'PEN' => [
			'name'   => __( 'Peruvian Nuevo Sol', 'rewardswp' ),
			'symbol' => 'S/.',
		],
		'PGK' => [
			'name'   => __( 'Papua New Guinean Kina', 'rewardswp' ),
			'symbol' => 'K',
		],
		'PHP' => [
			'name'   => __( 'Philippine Peso', 'rewardswp' ),
			'symbol' => '₱',
		],
		'PKR' => [
			'name'   => __( 'Pakistani Rupee', 'rewardswp' ),
			'symbol' => '₨',
		],
		'PLN' => [
			'name'   => __( 'Polish Zloty', 'rewardswp' ),
			'symbol' => 'zł',
		],
		'PYG' => [
			'name'   => __( 'Paraguayan Guarani', 'rewardswp' ),
			'symbol' => '₲',
		],
		'QAR' => [
			'name'   => __( 'Qatari Rial', 'rewardswp' ),
			'symbol' => '﷼',
		],
		'RON' => [
			'name'   => __( 'Romanian Leu', 'rewardswp' ),
			'symbol' => 'lei',
		],
		'RSD' => [
			'name'   => __( 'Serbian Dinar', 'rewardswp' ),
			'symbol' => 'Дин.',
		],
		'RWF' => [
			'name'   => __( 'Rwandan Franc', 'rewardswp' ),
			'symbol' => 'R₣',
		],
		'SAR' => [
			'name'   => __( 'Saudi Riyal', 'rewardswp' ),
			'symbol' => '﷼',
		],
		'SBD' => [
			'name'   => __( 'Solomon Islands Dollar', 'rewardswp' ),
			'symbol' => '$',
		],
		'SCR' => [
			'name'   => __( 'Seychellois Rupee', 'rewardswp' ),
			'symbol' => '₨',
		],
		'SDG' => [
			'name'   => __( 'Sudanese Pound', 'rewardswp' ),
			'symbol' => 'ج.س.',
		],
		'SHP' => [
			'name'   => __( 'Saint Helena Pound', 'rewardswp' ),
			'symbol' => '£',
		],
		'SLL' => [
			'name'   => __( 'Sierra Leonean Leone', 'rewardswp' ),
			'symbol' => 'Le',
		],
		'SOS' => [
			'name'   => __( 'Somali Shilling', 'rewardswp' ),
			'symbol' => 'S',
		],
		'SRD' => [
			'name'   => __( 'Surinamese Dollar', 'rewardswp' ),
			'symbol' => '$',
		],
		'SSP' => [
			'name'   => __( 'South Sudanese Pound', 'rewardswp' ),
			'symbol' => '£',
		],
		'STN' => [
			'name'   => __( 'São Tomé and Príncipe Dobra', 'rewardswp' ),
			'symbol' => 'Db',
		],
		'SVC' => [
			'name'   => __( 'Salvadoran Colón', 'rewardswp' ),
			'symbol' => '$',
		],
		'SYP' => [
			'name'   => __( 'Syrian Pound', 'rewardswp' ),
			'symbol' => '£',
		],
		'SZL' => [
			'name'   => __( 'Swazi Lilangeni', 'rewardswp' ),
			'symbol' => 'L',
		],
		'THB' => [
			'name'   => __( 'Thai Baht', 'rewardswp' ),
			'symbol' => '฿',
		],
		'TJS' => [
			'name'   => __( 'Tajikistani Somoni', 'rewardswp' ),
			'symbol' => 'SM',
		],
		'TMT' => [
			'name'   => __( 'Turkmenistani Manat', 'rewardswp' ),
			'symbol' => 'T',
		],
		'TND' => [
			'name'   => __( 'Tunisian Dinar', 'rewardswp' ),
			'symbol' => 'د.ت',
		],
		'TOP' => [
			'name'   => __( 'Tongan Pa\'anga', 'rewardswp' ),
			'symbol' => 'T$',
		],
		'TTD' => [
			'name'   => __( 'Trinidad and Tobago Dollar', 'rewardswp' ),
			'symbol' => 'TT$',
		],
		'TWD' => [
			'name'   => __( 'New Taiwan Dollar', 'rewardswp' ),
			'symbol' => 'NT$',
		],
		'TZS' => [
			'name'   => __( 'Tanzanian Shilling', 'rewardswp' ),
			'symbol' => 'TSh',
		],
		'UAH' => [
			'name'   => __( 'Ukrainian Hryvnia', 'rewardswp' ),
			'symbol' => '₴',
		],
		'UGX' => [
			'name'   => __( 'Ugandan Shilling', 'rewardswp' ),
			'symbol' => 'USh',
		],
		'UYU' => [
			'name'   => __( 'Uruguayan Peso', 'rewardswp' ),
			'symbol' => '$U',
		],
		'UZS' => [
			'name'   => __( 'Uzbekistan Som', 'rewardswp' ),
			'symbol' => 'лв',
		],
		'VES' => [
			'name'   => __( 'Venezuelan Bolívar', 'rewardswp' ),
			'symbol' => 'Bs',
		],
		'VND' => [
			'name'   => __( 'Vietnamese Dong', 'rewardswp' ),
			'symbol' => '₫',
		],
		'VUV' => [
			'name'   => __( 'Vanuatu Vatu', 'rewardswp' ),
			'symbol' => 'VT',
		],
		'WST' => [
			'name'   => __( 'Samoan Tala', 'rewardswp' ),
			'symbol' => 'WS$',
		],
		'XAF' => [
			'name'   => __( 'CFA Franc BEAC', 'rewardswp' ),
			'symbol' => 'FCFA',
		],
		'XCD' => [
			'name'   => __( 'East Caribbean Dollar', 'rewardswp' ),
			'symbol' => '$',
		],
		'XDR' => [
			'name'   => __( 'Special Drawing Rights', 'rewardswp' ),
			'symbol' => 'SDR',
		],
		'XOF' => [
			'name'   => __( 'CFA Franc BCEAO', 'rewardswp' ),
			'symbol' => 'CFA',
		],
		'XPF' => [
			'name'   => __( 'CFP Franc', 'rewardswp' ),
			'symbol' => '₣',
		],
		'YER' => [
			'name'   => __( 'Yemeni Rial', 'rewardswp' ),
			'symbol' => '﷼',
		],
		'ZMW' => [
			'name'   => __( 'Zambian Kwacha', 'rewardswp' ),
			'symbol' => 'ZK',
		],
		'ZWL' => [
			'name'   => __( 'Zimbabwean Dollar', 'rewardswp' ),
			'symbol' => '$',
		],
	];
}
