<?php

namespace Devurai\AcceptbluePaymentPro\Settings;

class SettingsMap
{
    public static array $settings;

    /**
     * Initializes and stores settings instances in the settings array.
     *
     * This method populates the settings array with instances of various settings classes,
     * using their unique identifiers as keys.
     *
     * @return void
     */
    protected static function get_settings(): void
    {
        self::$settings[ACHSettings::getInstance()->get_settings_id()] = ACHSettings::getInstance();
        self::$settings[CCSettings::getInstance()->get_settings_id()] = CCSettings::getInstance();
        self::$settings[GooglePaySettings::getInstance()->get_settings_id()] = GooglePaySettings::getInstance();
    }

    /**
     * Retrieves the setting instance for the given identifier.
     *
     * @param mixed $id The identifier of the setting to retrieve.
     * @return mixed The value of the setting if it exists, or false if it does not exist.
     */
    public static function get(string $id)
    {
        self::get_settings();
        return self::$settings[$id] ?? false;
    }
}