<?php

declare( strict_types=1 );

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

/**
 * Returns all supported currencies as code => label pairs.
 * Popular currencies are listed first; used for API validation and admin UI.
 *
 * @return array<string,string>
 */
function playard_get_currency_list(): array {
	return [
		// Popular (per spec order)
		'BDT' => 'BDT — Bangladeshi Taka',
		'USD' => 'USD — US Dollar',
		'EUR' => 'EUR — Euro',
		'GBP' => 'GBP — British Pound',
		'AED' => 'AED — UAE Dirham',
		'INR' => 'INR — Indian Rupee',
		'PKR' => 'PKR — Pakistani Rupee',
		'PHP' => 'PHP — Philippine Peso',
		'NGN' => 'NGN — Nigerian Naira',
		'KES' => 'KES — Kenyan Shilling',
		'MYR' => 'MYR — Malaysian Ringgit',
		'SGD' => 'SGD — Singapore Dollar',
		// Extended list
		'AUD' => 'AUD — Australian Dollar',
		'BRL' => 'BRL — Brazilian Real',
		'CAD' => 'CAD — Canadian Dollar',
		'CHF' => 'CHF — Swiss Franc',
		'CNY' => 'CNY — Chinese Yuan',
		'EGP' => 'EGP — Egyptian Pound',
		'GHS' => 'GHS — Ghanaian Cedi',
		'IDR' => 'IDR — Indonesian Rupiah',
		'JPY' => 'JPY — Japanese Yen',
		'KWD' => 'KWD — Kuwaiti Dinar',
		'MAD' => 'MAD — Moroccan Dirham',
		'MXN' => 'MXN — Mexican Peso',
		'QAR' => 'QAR — Qatari Riyal',
		'RWF' => 'RWF — Rwandan Franc',
		'SAR' => 'SAR — Saudi Riyal',
		'THB' => 'THB — Thai Baht',
		'TND' => 'TND — Tunisian Dinar',
		'TZS' => 'TZS — Tanzanian Shilling',
		'UGX' => 'UGX — Ugandan Shilling',
		'XOF' => 'XOF — West African CFA Franc',
		'ZAR' => 'ZAR — South African Rand',
	];
}

/**
 * Returns the list of sports supported by Playard.
 * Each entry has: key (DB value), label (display name), icon (emoji).
 * Used for whitelist validation server-side and for the admin UI.
 *
 * @return array<int, array{key: string, label: string, icon: string}>
 */
function playard_get_default_sports(): array {
	return [
		[ 'key' => 'football',   'label' => 'Football',   'icon' => '⚽' ],
		[ 'key' => 'cricket',    'label' => 'Cricket',    'icon' => '🏏' ],
		[ 'key' => 'badminton',  'label' => 'Badminton',  'icon' => '🏸' ],
		[ 'key' => 'basketball', 'label' => 'Basketball', 'icon' => '🏀' ],
		[ 'key' => 'tennis',     'label' => 'Tennis',     'icon' => '🎾' ],
		[ 'key' => 'volleyball', 'label' => 'Volleyball', 'icon' => '🏐' ],
		[ 'key' => 'futsal',     'label' => 'Futsal',     'icon' => '⚽' ],
		[ 'key' => 'squash',     'label' => 'Squash',     'icon' => '🎾' ],
		[ 'key' => 'other',      'label' => 'Other',      'icon' => '🏅' ],
	];
}

/**
 * Returns the currency symbol for a given currency code.
 *
 * @param string $code  ISO 4217 currency code.
 * @return string  Symbol, or the code itself if not found.
 */
function playard_get_currency_symbol( string $code ): string {
	$symbols = [
		'BDT' => '৳',
		'USD' => '$',
		'EUR' => '€',
		'GBP' => '£',
		'AED' => 'د.إ',
		'INR' => '₹',
		'PKR' => '₨',
		'PHP' => '₱',
		'NGN' => '₦',
		'KES' => 'KSh',
		'MYR' => 'RM',
		'SGD' => 'S$',
		'AUD' => 'A$',
		'BRL' => 'R$',
		'CAD' => 'CA$',
		'CHF' => 'Fr',
		'CNY' => '¥',
		'EGP' => '£',
		'GHS' => 'GH₵',
		'IDR' => 'Rp',
		'JPY' => '¥',
		'KWD' => 'KD',
		'MXN' => 'MX$',
		'QAR' => '﷼',
		'SAR' => '﷼',
		'THB' => '฿',
		'ZAR' => 'R',
	];

	return $symbols[ $code ] ?? $code;
}
