/*
 * @license Private Source License v1.0.0
 * @copyright 2023 Reinhardt Weyers
 *
 * @author Reinhardt Weyers
 *
 * @version 0.1.0
 * 
 * Created On: 04/12/25
 * Last edited: 04/12/25
 */

using System.Threading.Tasks;
using UnityEngine;

namespace RetroDev.Secrets
{
    /// <summary>
    /// Manages secrets retrieval.
    /// </summary>
    public class Secrets
    {
        /// <summary>
        /// Instance of SecretManager used to load and retrieve secrets.
        /// </summary>
        private SecretManager secretManager;

        /// <summary>
        /// Initializes a new instance of the <see cref="Secrets"/> class.
        /// </summary>
        public Secrets()
        {
            // Constructor logic can be added here if needed
        }

        /// <summary>
        /// Retrieves a secret string associated with the specified key.
        /// </summary>
        /// <param name="secretKey">The key for the secret to be retrieved.</param>
        /// <returns>A task that represents the asynchronous operation. The task result contains the secret string.</returns>
        public string GetSecret(string secretKey)
        {
            if (secretManager == null)
            {
                secretManager = Resources.Load<SecretManager>("SecretManager");
            }
            return secretManager.keyValuePairs[secretKey];
        }
    }
}
