using UnityEngine;

namespace InterfaceOff
{
    [System.Serializable] public struct ImageSet
    {
        [field: SerializeField] public Sprite[] Images { get; set; }
    }
    
    [CreateAssetMenu(fileName = "Image Registry", menuName = "Custom/Create Image Registry")]
    public class ImageRegistry : ScriptableObject
    {
        [field: SerializeField] private ImageSet[] m_Registered;
        private static ImageRegistry Instance;

        [RuntimeInitializeOnLoadMethod(RuntimeInitializeLoadType.BeforeSceneLoad)]
        private static void LoadRegistry() => Instance = Resources.Load<ImageRegistry>("ImageRegistry");

        public static Sprite[] GetRandomSpriteSet()
        {
            int index = Random.Range(0, Instance.m_Registered.Length);
            return Instance.m_Registered[index].Images;
        }
    }
}