<?php

namespace Bookingor\Backend\Controller\Settings;

use Bookingor\Integrations\Email\EmailNotification;
use GuzzleHttp\Client;

//Load Composer"s autoloader
class SettingsControl
{
    /**
     * List of all available currencies.
     *
     * @var array
     */
    public $all_currency_list;
    /**
     * Prefix used for naming conventions in the booking system.
     *
     * @var string
     */
    public static $name_prefix = 'bookingor';

    /**
     * Ajax function to send test email using current email settings.
     *
     * @return void
     */
    public function bp_settings_email_test()
    {
        if (isset($_REQUEST['action'])) {


            if (isset($_POST['nonce'])) {
                if (!wp_verify_nonce(sanitize_text_field(wp_unslash($_POST['nonce'])), 'bookingor_ajax_nonce')) {
                    $response = [
                        'status' => htmlspecialchars('error'),
                        'message' => htmlspecialchars('Nonce verification failed.')
                    ];
                    echo wp_json_encode($response);
                    die;
                }
            }

            $mail_type = get_option(self::$name_prefix . '_settings_email_type') ?: 'wp_mail';
            $to = isset($_POST['wp_sender_email']) ? sanitize_email(wp_unslash($_POST['wp_sender_email'])) : get_option(self::$name_prefix . '_settings_wp_email_sender');
            if (empty($to)) {
                $to = get_option('admin_email');
            }
            
            // fix test sending email issue
            if ($mail_type === 'wp_mail') {
                $subject = 'Test Email';
                $body = 'Test Email Via WP Mail';
                
                $mail_error = null;
                $catch_mail_error = function($error) use (&$mail_error) {
                    if (is_wp_error($error)) {
                        $mail_error = $error->get_error_message();
                    }
                };
                add_action('wp_mail_failed', $catch_mail_error);
                
                $mailed = EmailNotification::sendEmail($to, $subject, $body);
                
                remove_action('wp_mail_failed', $catch_mail_error);
                
                if ($mailed) {
                    $response = [
                        'status' => 'success',
                        'message' => __('Test email sent successfully via WP Mail.', 'bookingor'),
                    ];
                } else {
                    $error_message = __('Failed to send test email via WP Mail.', 'bookingor');
                    if (!empty($mail_error)) {
                        $error_message .= ' Reason: ' . $mail_error;
                    } else {
                        $error_message .= ' ' . __('Please check your server mail configuration.', 'bookingor');
                    }
                    $response = [
                        'status' => 'error',
                        'message' => $error_message,
                    ];
                }
                echo wp_json_encode($response);
            }
            die;
        }
    }


    /**
     * This function is used to add all the options used in the plugin.
     *
     * This function is called when the plugin is activated.
     *
     * This function adds the default values for all the options.
     *
     * @return void
     */
    public static function Adds_Options()
    {
        add_option(self::$name_prefix . '_settings_currency_symbol', '$');
        add_option(self::$name_prefix . '_settings_calender_format', 'monthly');
        add_option(self::$name_prefix . '_settings_calender_days', '10');
        add_option(self::$name_prefix . '_settings_category_frontend', 'required');
        add_option(self::$name_prefix . '_settings_service_frontend', 'required');
        add_option(self::$name_prefix . '_settings_staff_frontend', 'required');
        // convert Duration
        add_option(self::$name_prefix . '_settings_convert_duration', 'minutes-to-hours');
        //stripe

        // woocommerce
        add_option(self::$name_prefix . '_settings_woocommcerce_payment_active', 'off');
        add_option(self::$name_prefix . '_settings_woocommcerce_payment_page', 'woocommerce-checkout');
        add_option(self::$name_prefix . '_settings_woocommerce_text_description', '');

        // default time slot
        add_option(self::$name_prefix . '_settings_default_time_slot', 1);
        //email setings
        add_option(self::$name_prefix . '_settings_wp_email_sender', get_option('admin_email'));
        add_option(self::$name_prefix . '_settings_wp_sender_name', get_option('blogname'));

        add_option(self::$name_prefix . '_options_service_cancel', '');
        add_option(self::$name_prefix . '_options_service_before_book', '');
        // booking status
        add_option(self::$name_prefix . '_settings_default_booking_status', 'approved');
        // customer settings
        add_option(self::$name_prefix . '_settings_customer_create_account', 'off');
        add_option(self::$name_prefix . '_settings_customer_delete_account', '');
        add_option(self::$name_prefix . '_settings_customer_set_username', '');
        add_option(self::$name_prefix . '_settings_customer_google_signin', '');
        add_option(self::$name_prefix . '_settings_customer_facebook_signin', '');
        // staff settings
        add_option(self::$name_prefix . '_settings_staff_create_account', '');
        add_option(self::$name_prefix . '_settings_staff_delete_account', '');
        add_option(self::$name_prefix . '_settings_staff_google_signin', '');
        add_option(self::$name_prefix . '_settings_staff_facebook_signin', '');
        add_option(self::$name_prefix . '_settings_staff_allow_account', 'off');
        // date setting
        add_option(self::$name_prefix . '_date_format', 'd-m-Y');
        // time setting
        add_option(self::$name_prefix . '_time_format', 'g:i a');
        // change currency position
        add_option(self::$name_prefix . '_currency_position_change', 'cur-poz-strt-no-sp');
        // currency decimal point
        add_option(self::$name_prefix . '_currency_decimal_point', '2');
        //default currency set:
        add_option(self::$name_prefix . '_settings_country_currency', 'USD');
        // default time sheet
        add_option(self::$name_prefix . '_settings_default_time_sheet', 'business-time-sheet');
        // UI Category
        add_option(self::$name_prefix . '_settings_category_active', 'on');
        add_option(self::$name_prefix . '_settings_service_active', 'on');
        add_option(self::$name_prefix . '_settings_staff_active', 'on');
        add_option(self::$name_prefix . '_settings_location_active', 'on');
        add_option(self::$name_prefix . '_settings_customer_details_active', 'on');
        add_option(self::$name_prefix . '_settings_customer_payment_active', 'on');
        add_option(self::$name_prefix . '_settings_category_images_icons', 'show-icons');
        // business
        add_option(self::$name_prefix . '_settings_business_details_active', 'on');
        add_option(self::$name_prefix . '_settings_business_logo_required', 'on');
        add_option(self::$name_prefix . '_settings_business_name_required', 'on');
        add_option(self::$name_prefix . '_settings_business_phone_required', 'on');
        add_option(self::$name_prefix . '_settings_business_description_required', 'on');
        add_option(self::$name_prefix . '_settings_business_email_required', 'on');
        add_option(self::$name_prefix . '_settings_logo_required', 'off');
        add_option(self::$name_prefix . '_settings_category_required', 'on');
        add_option(self::$name_prefix . '_settings_service_required', 'on');
        add_option(self::$name_prefix . '_settings_location_required', 'on');
        add_option(self::$name_prefix . '_settings_staff_required', 'on');
        add_option(self::$name_prefix . '_settings_category_name', 'Category');
        add_option(self::$name_prefix . '_settings_service_name', 'Services');
        add_option(self::$name_prefix . '_settings_location_name', 'Location');
        add_option(self::$name_prefix . '_settings_staff_name', 'Staff');
        add_option(self::$name_prefix . '_settings_date_time_name', 'Date & Time');
        add_option(self::$name_prefix . '_settings_customer_book_name', 'Cart');
        add_option(self::$name_prefix . '_settings_customer_payment_name', 'Payment');

        // service show
        add_option(self::$name_prefix . '_settings_service_price_show', 'on');
        add_option(self::$name_prefix . '_settings_service_duration_show', 'on');
        add_option(self::$name_prefix . '_settings_service_description_show', 'on');
        add_option(self::$name_prefix . '_settings_service_capacity_show', 'on');
        add_option(self::$name_prefix . '_settings_service_images_icons', 'show-icons');
        add_option(self::$name_prefix . '_setting_category_position', 1);
        add_option(self::$name_prefix . '_settings_service_position', 2);
        add_option(self::$name_prefix . '_settings_staff_position', 3);
        add_option(self::$name_prefix . '_settings_location_position', 4);
        add_option(self::$name_prefix . '_settings_date_time_position', 4);
        add_option(self::$name_prefix . '_settings_repeat_position', 5);
        add_option(self::$name_prefix . '_settings_default_calendar', '30-days-calendar');

        add_option(self::$name_prefix . '_settings_p_ky_id', '');
        add_option(self::$name_prefix . '_settings_p_ky', '');
        add_option(self::$name_prefix . '_settings_p_data', '');

        add_option(self::$name_prefix . '_setup_completed', 'no');

        // editings
        add_option(self::$name_prefix . '_settings_color_sidebar', '#5e37d5');
        add_option(self::$name_prefix . '_settings_color_sidebar_text', '#FFFFFF');
        add_option(self::$name_prefix . '_settings_color_sidebar_text_active', '#000000');
        add_option(self::$name_prefix . '_settings_color_border', '#000000');
        add_option(self::$name_prefix . '_settings_color_continue_button_background', '#5e37d5');
        add_option(self::$name_prefix . '_settings_color_continue_button_text', '#FFFFFF');
        add_option(self::$name_prefix . '_settings_color_back_button_background', '#5e37d5');
        add_option(self::$name_prefix . '_settings_color_back_button_text', '#FFFFFF');
        add_option(self::$name_prefix . '_settings_color_hover_border', '#7752DD');
        add_option(self::$name_prefix . '_settings_color_bg_border', '#7752DD');
        add_option(self::$name_prefix . '_settings_back_button_text', 'Back');
        add_option(self::$name_prefix . '_settings_continue_button_text', 'Continue');
        add_option(self::$name_prefix . '_settings_book_button_text', 'Book');
        add_option(self::$name_prefix . '_settings_customer_payment_required', 'on');
        add_option(self::$name_prefix . '_settings_customer_details_required', 'on');
        add_option(self::$name_prefix . '_settings_cart_information_required', 'on');
        add_option(self::$name_prefix . '_settings_cart_payment_information_required', 'on');

        add_option(self::$name_prefix . '_settings_button_text_book', 'Book');

        // design 1
        add_option(self::$name_prefix . '_settings_background_border_active_design_1', '1px');
        add_option(self::$name_prefix . '_settings_background_border_color_design_1', '#cccccc');
        add_option(self::$name_prefix . '_settings_background_radius_design_1', '0px');

        // design 2
        add_option(self::$name_prefix . '_settings_background_border_active_design_2', '1px');
        add_option(self::$name_prefix . '_settings_background_border_color_design_2', '#cccccc');
        add_option(self::$name_prefix . '_settings_background_radius_design_2', '6px');

        // design 3
        add_option(self::$name_prefix . '_settings_background_border_active_design_3', '1px');
        add_option(self::$name_prefix . '_settings_background_border_color_design_3', '#cccccc');
        add_option(self::$name_prefix . '_settings_background_radius_design_3', '0px');
        add_option(self::$name_prefix . '_settings_status_active_text_color', '#000000');
        add_option(self::$name_prefix . '_settings_status_completed_text_color', '#cccccc');
        add_option(self::$name_prefix . '_settings_color_label_text', '#272727');

        add_option(self::$name_prefix . '_settings_status_progress_bar_background_color', '#12b76a');

        // design 4
        add_option(self::$name_prefix . '_settings_background_border_active_design_4', '1px');
        add_option(self::$name_prefix . '_settings_background_border_color_design_4', '#cccccc');
        add_option(self::$name_prefix . '_settings_background_radius_design_4', '0px');

        // design 6
        add_option(self::$name_prefix . '_settings_background_border_active_design_6', '1px');
        add_option(self::$name_prefix . '_settings_background_border_color_design_6', '#cccccc');
        add_option(self::$name_prefix . '_settings_background_radius_design_6', '0px');

        add_option(self::$name_prefix . '_settings_background_border_design_1_active', '1px');
        add_option(self::$name_prefix . '_settings_background_border_design_1_color', '#cccccc');
        add_option(self::$name_prefix . '_settings_background_border_color', '#000000');
        add_option(self::$name_prefix . '_settings_background_design_1_radius', '0px');
        add_option(self::$name_prefix . '_settings_buttons_border_active', '0px');
        add_option(self::$name_prefix . '_settings_buttons_radius', '10px');
        add_option(self::$name_prefix . '_settings_buttons_border_color', '#000000');
        add_option(self::$name_prefix . '_settings_fonts_headings', '');
        add_option(self::$name_prefix . '_settings_fonts_all_other', '');
        add_option(self::$name_prefix . '_settings_customer_first_name_active', 'on');
        add_option(self::$name_prefix . '_settings_customer_last_name_active', 'on');
        add_option(self::$name_prefix . '_settings_customer_email_active', 'on');
        add_option(self::$name_prefix . '_settings_customer_phone_active', 'on');

        add_option(self::$name_prefix . '_settings_customer_first_name_label', 'First Name');
        add_option(self::$name_prefix . '_settings_customer_last_name_label', 'Last Name');
        add_option(self::$name_prefix . '_settings_customer_email_label', 'Email');
        add_option(self::$name_prefix . '_settings_customer_phone_label', 'Phone');
        add_option(self::$name_prefix . '_settings_pay_on_visit_name', 'Pay On Visit');

        add_option(self::$name_prefix . '_settings_booking_thank_you_text', 'Thank you');
        add_option(self::$name_prefix . '_settings_booking_confirm_text', 'Booking Confirmed');
        add_option(self::$name_prefix . '_settings_capacity_required', 'on');
        add_option(self::$name_prefix . '_settings_location_city', 'on');
        add_option(self::$name_prefix . '_settings_location_address', 'on');
        add_option(self::$name_prefix . '_settings_location_phone', 'on');
        add_option(self::$name_prefix . '_settings_design_3_active_color_text', '#ccc');
        add_option(self::$name_prefix . '_settings_time_name', 'Pick Time');

        add_option(self::$name_prefix . '_customer_dashboard_page', '/customer-dashboard');
        add_option(self::$name_prefix . '_staff_dashboard_page', '/staff-dashboard');
    }

    /**
     * Update booking settings.
     *
     * @return void
     */
    public static function bp_settings_update()
    {
        if (isset($_REQUEST['action'])) {
            if (isset($_POST['nonce'])) {
                if (!wp_verify_nonce(sanitize_text_field(wp_unslash($_POST['nonce'])), 'bookingor_ajax_nonce')) {
                    $response = [
                        'status' => htmlspecialchars('error'),
                        'message' => htmlspecialchars('Nonce verification failed.')
                    ];
                    echo wp_json_encode($response);
                }
            }
            if (!current_user_can('manage_options')) {
                $response = [
                    'status' => htmlspecialchars('error'),
                    'message' => htmlspecialchars('You do not have permission.')
                ];
                echo wp_json_encode($response);
                die();
            }
            update_option(self::$name_prefix . '_customer_dashboard_page', sanitize_text_field(wp_unslash($_POST['settings_customer_dashboard_page'] ?? '')));
            update_option(self::$name_prefix . '_staff_dashboard_page', sanitize_text_field(wp_unslash($_POST['settings_staff_dashboard_page'] ?? '')));

            update_option(self::$name_prefix . '_settings_currency_symbol', sanitize_text_field(wp_unslash($_POST['bpro_settings_Country_price_symobl'] ?? '')));
            update_option(self::$name_prefix . '_settings_country_currency', sanitize_text_field(wp_unslash($_POST['settings_country_currency'] ?? '')));
            update_option(self::$name_prefix . '_settings_default_time_slot', sanitize_text_field(wp_unslash($_POST['bpro_settings_default_time_slot'] ?? '')));
            // convert Duration
            update_option(self::$name_prefix . '_settings_convert_duration', sanitize_text_field(wp_unslash($_POST['settings_duration_convert'] ?? '')));
            //stripe

            // woocommerce
            update_option(self::$name_prefix . '_settings_woocommcerce_payment_page', sanitize_text_field(wp_unslash($_POST['woocommerce_payment_page'] ?? '')));
            update_option(self::$name_prefix . '_settings_woocommcerce_payment_active', sanitize_text_field(isset($_POST['payment_woocommerce_active']) ? sanitize_text_field(wp_unslash($_POST['payment_woocommerce_active'])) : 'off'));

            update_option(self::$name_prefix . '_settings_twilio_to_number', sanitize_text_field(wp_unslash($_POST['twilio_to_number'] ?? '')));

            // email Type Setting
            update_option(self::$name_prefix . '_settings_email_type', sanitize_text_field(wp_unslash($_POST['settings_email_type'] ?? '')));

            //wp_mail sender
            update_option(self::$name_prefix . '_settings_wp_email_sender', sanitize_text_field(wp_unslash($_POST['setting_wp_sender_email'] ?? '')));
            update_option(self::$name_prefix . '_settings_wp_sender_name', sanitize_text_field(wp_unslash($_POST['setting_wp_email_sender_name'] ?? '')));

            // default booking status
            update_option(self::$name_prefix . '_settings_default_booking_status', sanitize_text_field(wp_unslash($_POST['setting_default_booking_status'] ?? '')));

            // date_format
            update_option(self::$name_prefix . '_date_format', sanitize_text_field(wp_unslash($_POST['setting_date_format'] ?? '')));

            // time format
            update_option(self::$name_prefix . '_time_format', sanitize_text_field(wp_unslash($_POST['setting_time_format'] ?? '')));

            // currency change format currency_position_change
            update_option(self::$name_prefix . '_currency_position_change', sanitize_text_field(wp_unslash($_POST['setting_currency_position'] ?? '')));

            // currency decimals change
            update_option(self::$name_prefix . '_currency_decimal_point', sanitize_text_field(wp_unslash($_POST['setting_currency_decimal'] ?? '')));

            // customer role update
            update_option(self::$name_prefix . '_settings_customer_create_account', sanitize_text_field(wp_unslash($_POST['settings_customer_create_account'] ?? '')));

            // staff role
            update_option(self::$name_prefix . '_settings_staff_allow_account', sanitize_text_field(isset($_POST['settings_staff_allow_account']) ? sanitize_text_field(wp_unslash($_POST['settings_staff_allow_account'])) : 'off'));
            // default time sheet

            // update Time sheet settings
            update_option(self::$name_prefix . '_settings_default_time_sheet', sanitize_text_field(wp_unslash($_POST['bookingor_setting_set_default_time_sheet'] ?? '')));
            update_option(self::$name_prefix . '_settings_business_details_active', sanitize_text_field(wp_unslash($_POST['settings_business_details_active'] ?? '')));
            update_option(self::$name_prefix . '_settings_repeat_position', sanitize_text_field(isset($_POST['settings_repeat_set_position']) ? sanitize_text_field(wp_unslash($_POST['settings_repeat_set_position'])) : ''));
            update_option(self::$name_prefix . '_settings_default_calendar', sanitize_text_field(isset($_POST['settings_default_set_calendar']) ? sanitize_text_field(wp_unslash($_POST['settings_default_set_calendar'])) : ''));            // service show

            // sdfa

            $response = [
                'status' => htmlspecialchars('success'),
                'message' => htmlspecialchars('Settings updated successfully'),
            ];
            echo wp_json_encode($response);
            exit;
        }
    }

    public static function bp_settings_get_data()
    {
        if (isset($_REQUEST['action'])) {
            if (isset($_POST['nonce'])) {
                if (!wp_verify_nonce(sanitize_text_field(wp_unslash($_POST['nonce'])), 'bookingor_ajax_nonce')) {
                    $response = [
                        'status' => htmlspecialchars('error'),
                        'message' => htmlspecialchars('Nonce verification failed.')
                    ];
                    echo wp_json_encode($response);
                }
            }

            //stripe
            $dcimal_point = get_option(self::$name_prefix . '_currency_decimal_point');

            $stripe_data = [
                'bookingor_business_timesheet' => get_option(self::$name_prefix . '_business_hours'),
                'is_woocommerce_active' => get_option(self::$name_prefix . '_settings_woocommcerce_payment_active'),
                'active_category' => get_option(self::$name_prefix . '_settings_category_active'),
                'active_staff' => get_option(self::$name_prefix . '_settings_staff_active'),
                'active_location' => get_option(self::$name_prefix . '_settings_location_active'),
                'category_required' => get_option(self::$name_prefix . '_settings_category_required'),
                'default_time_sheet' => get_option(self::$name_prefix . '_settings_default_time_sheet'),
                'css_border_color' => get_option(self::$name_prefix . '_settings_color_border'),
                'date_format' => get_option(self::$name_prefix . '_date_format'),
                'decimal_point' => get_option(self::$name_prefix . '_currency_decimal_point'),
                'price_symbol' => get_option(self::$name_prefix . '_settings_currency_symbol'),

                'boookingor_css' => [
                    'bookingor_color_border' => get_option(self::$name_prefix . '_settings_color_border'),
                    'sidebar_1' => get_option(self::$name_prefix . '_settings_color_sidebar'),
                    'full_day_selected' => get_option(self::$name_prefix . 'bkinz-day-full.selected'),
                    'sidebar_text' => get_option(self::$name_prefix . '_settings_color_sidebar_text'),
                    'label_text_color' => get_option(self::$name_prefix . '_settings_color_label_text'),
                    'sidebar_text_active' => get_option(self::$name_prefix . '_settings_color_sidebar_text_active'),
                    'search_bars' => get_option(self::$name_prefix . '_settings_color_continue_button_background'),
                    'background_border_color' => get_option(self::$name_prefix . '_settings_background_border_color'),
                    'button_border_active' => get_option(self::$name_prefix . '_settings_buttons_border_active'),
                    'button_border_color' => get_option(self::$name_prefix . '_settings_buttons_border_color'),
                    'button_border_radius' => get_option(self::$name_prefix . '_settings_buttons_radius'),
                    'heading_font_family' => get_option(self::$name_prefix . '_settings_fonts_headings'),
                    'all_other_font_family' => get_option(self::$name_prefix . '_settings_fonts_all_other'),
                    'capacity_people_text' => get_option(self::$name_prefix . '_settings_capacity_people_text'),

                    // design 1
                    'background_border_active_design_1' => get_option(self::$name_prefix . '_settings_background_border_active_design_1'),
                    'background_border_color_design_1' => get_option(self::$name_prefix . '_settings_background_border_color_design_1'),
                    'background_border_radius_design_1' => get_option(self::$name_prefix . '_settings_background_radius_design_1'),

                    // design 2
                    'background_border_active_design_2' => get_option(self::$name_prefix . '_settings_background_border_active_design_2'),
                    'background_border_color_design_2' => get_option(self::$name_prefix . '_settings_background_border_color_design_2'),
                    'background_border_radius_design_2' => get_option(self::$name_prefix . '_settings_background_radius_design_2'),

                    // design 3
                    'status_active_text_color_design_3' => get_option(self::$name_prefix . '_settings_status_active_text_color'),
                    'status_completed_text_color_design_3' => get_option(self::$name_prefix . '_settings_status_completed_text_color'),
                    'status_progress_bar_color_design_3' => get_option(self::$name_prefix . '_settings_status_progress_bar_background_color'),
                    'background_border_active_design_3' => get_option(self::$name_prefix . '_settings_background_border_active_design_3'),
                    'background_border_color_design_3' => get_option(self::$name_prefix . '_settings_background_border_color_design_3'),
                    'background_border_radius_design_3' => get_option(self::$name_prefix . '_settings_background_radius_design_3'),

                    // design 4
                    'background_border_active_design_4' => get_option(self::$name_prefix . '_settings_background_border_active_design_4'),
                    'background_border_color_design_4' => get_option(self::$name_prefix . '_settings_background_border_color_design_4'),
                    'background_border_radius_design_4' => get_option(self::$name_prefix . '_settings_background_radius_design_4'),

                    // design 5
                    'background_border_active_design_5' => get_option(self::$name_prefix . '_settings_background_border_active_design_5'),
                    'background_border_color_design_5' => get_option(self::$name_prefix . '_settings_background_border_color_design_5'),

                    //design 6
                    'background_border_active_design_6' => get_option(self::$name_prefix . '_settings_background_border_active_design_6'),
                    'background_border_color_design_6' => get_option(self::$name_prefix . '_settings_background_border_color_design_6'),
                    'background_border_radius_design_6' => get_option(self::$name_prefix . '_settings_background_radius_design_6'),

                ],

                'bookingor_cont_btn' => [
                    'bg' => get_option(self::$name_prefix . '_settings_color_continue_button_background'),
                    'clr' => get_option(self::$name_prefix . '_settings_color_continue_button_text'),
                ],
                'bookingor_btn_back' => [
                    'bg' => get_option(self::$name_prefix . '_settings_color_back_button_background'),
                    'clr' => get_option(self::$name_prefix . '_settings_color_back_button_text'),
                ],
            ];
            echo wp_json_encode($stripe_data);
            die();
        }
    }


    /**
     * Returns an array of currency codes and their respective names and symbols.
     *
     * @return array
     */
    public static function Currency_lists()
    {
        return [
            'AFA' => ['name' => 'Afghan Afghani', 'symbol' => '؋'],
            'ALL' => ['name' => 'Albanian Lek', 'symbol' => 'Lek'],
            'DZD' => ['name' => 'Algerian Dinar', 'symbol' => 'دج'],
            'AOA' => ['name' => 'Angolan Kwanza', 'symbol' => 'Kz'],
            'ARS' => ['name' => 'Argentine Peso', 'symbol' => '$'],
            'AMD' => ['name' => 'Armenian Dram', 'symbol' => '֏'],
            'AWG' => ['name' => 'Aruban Florin', 'symbol' => 'ƒ'],
            'AUD' => ['name' => 'Australian Dollar', 'symbol' => '$'],
            'AZN' => ['name' => 'Azerbaijani Manat', 'symbol' => 'm'],
            'BSD' => ['name' => 'Bahamian Dollar', 'symbol' => 'B$'],
            'BHD' => ['name' => 'Bahraini Dinar', 'symbol' => '.د.ب'],
            'BDT' => ['name' => 'Bangladeshi Taka', 'symbol' => '৳'],
            'BBD' => ['name' => 'Barbadian Dollar', 'symbol' => 'Bds$'],
            'BYR' => ['name' => 'Belarusian Ruble', 'symbol' => 'Br'],
            'BEF' => ['name' => 'Belgian Franc', 'symbol' => 'fr'],
            'BZD' => ['name' => 'Belize Dollar', 'symbol' => '$'],
            'BMD' => ['name' => 'Bermudan Dollar', 'symbol' => '$'],
            'BTN' => ['name' => 'Bhutanese Ngultrum', 'symbol' => 'Nu.'],
            'BTC' => ['name' => 'Bitcoin', 'symbol' => '฿'],
            'BOB' => ['name' => 'Bolivian Boliviano', 'symbol' => 'Bs.'],
            'BAM' => ['name' => 'Bosnia', 'symbol' => 'KM'],
            'BWP' => ['name' => 'Botswanan Pula', 'symbol' => 'P'],
            'BRL' => ['name' => 'Brazilian Real', 'symbol' => 'R$'],
            'GBP' => ['name' => 'British Pound Sterling', 'symbol' => '£'],
            'BND' => ['name' => 'Brunei Dollar', 'symbol' => 'B$'],
            'BGN' => ['name' => 'Bulgarian Lev', 'symbol' => 'Лв.'],
            'BIF' => ['name' => 'Burundian Franc', 'symbol' => 'FBu'],
            'KHR' => ['name' => 'Cambodian Riel', 'symbol' => 'KHR'],
            'CAD' => ['name' => 'Canadian Dollar', 'symbol' => '$'],
            'CVE' => ['name' => 'Cape Verdean Escudo', 'symbol' => '$'],
            'KYD' => ['name' => 'Cayman Islands Dollar', 'symbol' => '$'],
            'XOF' => ['name' => 'CFA Franc BCEAO', 'symbol' => 'CFA'],
            'XAF' => ['name' => 'CFA Franc BEAC', 'symbol' => 'FCFA'],
            'XPF' => ['name' => 'CFP Franc', 'symbol' => '₣'],
            'CLP' => ['name' => 'Chilean Peso', 'symbol' => '$'],
            'CNY' => ['name' => 'Chinese Yuan', 'symbol' => '¥'],
            'COP' => ['name' => 'Colombian Peso', 'symbol' => '$'],
            'KMF' => ['name' => 'Comorian Franc', 'symbol' => 'CF'],
            'CDF' => ['name' => 'Congolese Franc', 'symbol' => 'FC'],
            'CRC' => ['name' => 'Costa Rican ColÃ³n', 'symbol' => '₡'],
            'HRK' => ['name' => 'Croatian Kuna', 'symbol' => 'kn'],
            'CUC' => ['name' => 'Cuban Convertible Peso', 'symbol' => '$, CUC'],
            'CZK' => ['name' => 'Czech Republic Koruna', 'symbol' => 'Kč'],
            'DKK' => ['name' => 'Danish Krone', 'symbol' => 'Kr.'],
            'DJF' => ['name' => 'Djiboutian Franc', 'symbol' => 'Fdj'],
            'DOP' => ['name' => 'Dominican Peso', 'symbol' => '$'],
            'XCD' => ['name' => 'East Caribbean Dollar', 'symbol' => '$'],
            'EGP' => ['name' => 'Egyptian Pound', 'symbol' => 'ج.م'],
            'ERN' => ['name' => 'Eritrean Nakfa', 'symbol' => 'Nfk'],
            'EEK' => ['name' => 'Estonian Kroon', 'symbol' => 'kr'],
            'ETB' => ['name' => 'Ethiopian Birr', 'symbol' => 'Nkf'],
            'EUR' => ['name' => 'Euro', 'symbol' => '€'],
            'FKP' => ['name' => 'Falkland Islands Pound', 'symbol' => '£'],
            'FJD' => ['name' => 'Fijian Dollar', 'symbol' => 'FJ$'],
            'GMD' => ['name' => 'Gambian Dalasi', 'symbol' => 'D'],
            'GEL' => ['name' => 'Georgian Lari', 'symbol' => 'ლ'],
            'DEM' => ['name' => 'German Mark', 'symbol' => 'DM'],
            'GHS' => ['name' => 'Ghanaian Cedi', 'symbol' => 'GH₵'],
            'GIP' => ['name' => 'Gibraltar Pound', 'symbol' => '£'],
            'GRD' => ['name' => 'Greek Drachma', 'symbol' => '₯, Δρχ, Δρ'],
            'GTQ' => ['name' => 'Guatemalan Quetzal', 'symbol' => 'Q'],
            'GNF' => ['name' => 'Guinean Franc', 'symbol' => 'FG'],
            'GYD' => ['name' => 'Guyanaese Dollar', 'symbol' => '$'],
            'HTG' => ['name' => 'Haitian Gourde', 'symbol' => 'G'],
            'HNL' => ['name' => 'Honduran Lempira', 'symbol' => 'L'],
            'HKD' => ['name' => 'Hong Kong Dollar', 'symbol' => '$'],
            'HUF' => ['name' => 'Hungarian Forint', 'symbol' => 'Ft'],
            'ISK' => ['name' => 'Icelandic KrÃ³na', 'symbol' => 'kr'],
            'INR' => ['name' => 'Indian Rupee', 'symbol' => '₹'],
            'IDR' => ['name' => 'Indonesian Rupiah', 'symbol' => 'Rp'],
            'IRR' => ['name' => 'Iranian Rial', 'symbol' => '﷼'],
            'IQD' => ['name' => 'Iraqi Dinar', 'symbol' => 'د.ع'],
            'ILS' => ['name' => 'Israeli New Sheqel', 'symbol' => '₪'],
            'ITL' => ['name' => 'Italian Lira', 'symbol' => 'L,£'],
            'JMD' => ['name' => 'Jamaican Dollar', 'symbol' => 'J$'],
            'JPY' => ['name' => 'Japanese Yen', 'symbol' => '¥'],
            'JOD' => ['name' => 'Jordanian Dinar', 'symbol' => 'ا.د'],
            'KZT' => ['name' => 'Kazakhstani Tenge', 'symbol' => 'лв'],
            'KES' => ['name' => 'Kenyan Shilling', 'symbol' => 'KSh'],
            'KWD' => ['name' => 'Kuwaiti Dinar', 'symbol' => 'ك.د'],
            'KGS' => ['name' => 'Kyrgystani Som', 'symbol' => 'лв'],
            'LAK' => ['name' => 'Laotian Kip', 'symbol' => '₭'],
            'LVL' => ['name' => 'Latvian Lats', 'symbol' => 'Ls'],
            'LBP' => ['name' => 'Lebanese Pound', 'symbol' => '£'],
            'LSL' => ['name' => 'Lesotho Loti', 'symbol' => 'L'],
            'LRD' => ['name' => 'Liberian Dollar', 'symbol' => '$'],
            'LYD' => ['name' => 'Libyan Dinar', 'symbol' => 'د.ل'],
            'LTL' => ['name' => 'Lithuanian Litas', 'symbol' => 'Lt'],
            'MOP' => ['name' => 'Macanese Pataca', 'symbol' => '$'],
            'MKD' => ['name' => 'Macedonian Denar', 'symbol' => 'ден'],
            'MGA' => ['name' => 'Malagasy Ariary', 'symbol' => 'Ar'],
            'MWK' => ['name' => 'Malawian Kwacha', 'symbol' => 'MK'],
            'MYR' => ['name' => 'Malaysian Ringgit', 'symbol' => 'RM'],
            'MVR' => ['name' => 'Maldivian Rufiyaa', 'symbol' => 'Rf'],
            'MRO' => ['name' => 'Mauritanian Ouguiya', 'symbol' => 'MRU'],
            'MUR' => ['name' => 'Mauritian Rupee', 'symbol' => '₨'],
            'MXN' => ['name' => 'Mexican Peso', 'symbol' => '$'],
            'MDL' => ['name' => 'Moldovan Leu', 'symbol' => 'L'],
            'MNT' => ['name' => 'Mongolian Tugrik', 'symbol' => '₮'],
            'MAD' => ['name' => 'Moroccan Dirham', 'symbol' => 'MAD'],
            'MZM' => ['name' => 'Mozambican Metical', 'symbol' => 'MT'],
            'MMK' => ['name' => 'Myanmar Kyat', 'symbol' => 'K'],
            'NAD' => ['name' => 'Namibian Dollar', 'symbol' => '$'],
            'NPR' => ['name' => 'Nepalese Rupee', 'symbol' => '₨'],
            'ANG' => ['name' => 'Netherlands Antillean Guilder', 'symbol' => 'ƒ'],
            'TWD' => ['name' => 'New Taiwan Dollar', 'symbol' => '$'],
            'NZD' => ['name' => 'New Zealand Dollar', 'symbol' => '$'],
            'NIO' => ['name' => 'Nicaraguan CÃ³rdoba', 'symbol' => 'C$'],
            'NGN' => ['name' => 'Nigerian Naira', 'symbol' => '₦'],
            'KPW' => ['name' => 'North Korean Won', 'symbol' => '₩'],
            'NOK' => ['name' => 'Norwegian Krone', 'symbol' => 'kr'],
            'OMR' => ['name' => 'Omani Rial', 'symbol' => '.ع.ر'],
            'PKR' => ['name' => 'Pakistani Rupee', 'symbol' => '₨'],
            'PAB' => ['name' => 'Panamanian Balboa', 'symbol' => 'B/.'],
            'PGK' => ['name' => 'Papua New Guinean Kina', 'symbol' => 'K'],
            'PYG' => ['name' => 'Paraguayan Guarani', 'symbol' => '₲'],
            'PEN' => ['name' => 'Peruvian Nuevo Sol', 'symbol' => 'S/.'],
            'PHP' => ['name' => 'Philippine Peso', 'symbol' => '₱'],
            'PLN' => ['name' => 'Polish Zloty', 'symbol' => 'zł'],
            'QAR' => ['name' => 'Qatari Rial', 'symbol' => 'ق.ر'],
            'RON' => ['name' => 'Romanian Leu', 'symbol' => 'lei'],
            'RUB' => ['name' => 'Russian Ruble', 'symbol' => '₽'],
            'RWF' => ['name' => 'Rwandan Franc', 'symbol' => 'FRw'],
            'SVC' => ['name' => 'Salvadoran ColÃ³n', 'symbol' => '₡'],
            'WST' => ['name' => 'Samoan Tala', 'symbol' => 'SAT'],
            'SAR' => ['name' => 'Saudi Riyal', 'symbol' => '﷼'],
            'RSD' => ['name' => 'Serbian Dinar', 'symbol' => 'din'],
            'SCR' => ['name' => 'Seychellois Rupee', 'symbol' => 'SRe'],
            'SLL' => ['name' => 'Sierra Leonean Leone', 'symbol' => 'Le'],
            'SGD' => ['name' => 'Singapore Dollar', 'symbol' => '$'],
            'SKK' => ['name' => 'Slovak Koruna', 'symbol' => 'Sk'],
            'SBD' => ['name' => 'Solomon Islands Dollar', 'symbol' => 'Si$'],
            'SOS' => ['name' => 'Somali Shilling', 'symbol' => 'Sh.so.'],
            'ZAR' => ['name' => 'South African Rand', 'symbol' => 'R'],
            'KRW' => ['name' => 'South Korean Won', 'symbol' => '₩'],
            'XDR' => ['name' => 'Special Drawing Rights', 'symbol' => 'SDR'],
            'LKR' => ['name' => 'Sri Lankan Rupee', 'symbol' => 'Rs'],
            'SHP' => ['name' => 'St. Helena Pound', 'symbol' => '£'],
            'SDG' => ['name' => 'Sudanese Pound', 'symbol' => '.س.ج'],
            'SRD' => ['name' => 'Surinamese Dollar', 'symbol' => '$'],
            'SZL' => ['name' => 'Swazi Lilangeni', 'symbol' => 'E'],
            'SEK' => ['name' => 'Swedish Krona', 'symbol' => 'kr'],
            'CHF' => ['name' => 'Swiss Franc', 'symbol' => 'CHf'],
            'SYP' => ['name' => 'Syrian Pound', 'symbol' => 'LS'],
            'STD' => ['name' => 'São Tomé and Príncipe Dobra', 'symbol' => 'Db'],
            'TJS' => ['name' => 'Tajikistani Somoni', 'symbol' => 'SM'],
            'TZS' => ['name' => 'Tanzanian Shilling', 'symbol' => 'TSh'],
            'THB' => ['name' => 'Thai Baht', 'symbol' => '฿'],
            'TOP' => ['name' => "Tongan pa'anga", 'symbol' => '$'],
            'TTD' => ['name' => 'Trinidad & Tobago Dollar', 'symbol' => '$'],
            'TND' => ['name' => 'Tunisian Dinar', 'symbol' => 'ت.د'],
            'TRY' => ['name' => 'Turkish Lira', 'symbol' => '₺'],
            'TMT' => ['name' => 'Turkmenistani Manat', 'symbol' => 'T'],
            'UGX' => ['name' => 'Ugandan Shilling', 'symbol' => 'USh'],
            'UAH' => ['name' => 'Ukrainian Hryvnia', 'symbol' => '₴'],
            'AED' => ['name' => 'United Arab Emirates Dirham', 'symbol' => 'إ.د'],
            'UYU' => ['name' => 'Uruguayan Peso', 'symbol' => '$'],
            'USD' => ['name' => 'United States Dollar', 'symbol' => '$'],
            'UZS' => ['name' => 'Uzbekistan Som', 'symbol' => 'лв'],
            'VUV' => ['name' => 'Vanuatu Vatu', 'symbol' => 'VT'],
            'VEF' => ['name' => 'Venezuelan BolÃvar', 'symbol' => 'Bs'],
            'VND' => ['name' => 'Vietnamese Dong', 'symbol' => '₫'],
            'YER' => ['name' => 'Yemeni Rial', 'symbol' => '﷼'],
            'ZMK' => ['name' => 'Zambian Kwacha', 'symbol' => 'ZK'],
        ];
    }
}
