using System.Collections.Generic;
using UnityEditor.Animations;
using UnityEngine;
using VRC.SDK3.Avatars.ScriptableObjects;

namespace PleasureArcade.ThiccWater
{
    [CreateAssetMenu(menuName = "PleasureArcade/ThiccWaterResources")]
    public class ThiccWaterResources : ScriptableObject
    {
        public string[] emitterNames;
        public GameObject[] emitters;
        public AnimatorController[] AnimatorControllers;
        public VRCExpressionsMenu menu;
        public Texture2D menuIcon;

        public GameObject depthProvider;

        private Dictionary<string, int> _emitterNameIndexes;

        /**
         * Look up an emitter array index by name (or -1 if it doesn't exist)
         */
        public int GetEmitterIndex(string emitterName)
        {
            if (_emitterNameIndexes == null)
            {
                _emitterNameIndexes = new Dictionary<string, int>(emitterNames.Length);
                for (var i = 0; i < emitterNames.Length; i++)
                {
                    _emitterNameIndexes.Add(emitterNames[i], i);
                }
            }

            return _emitterNameIndexes.ContainsKey(emitterName) ? _emitterNameIndexes[emitterName] : -1;
        }
    }
}