using EscapeRoomEngine.Engine.Runtime.Modules;
using NaughtyAttributes;

namespace EscapeRoomEngine.Desert.Runtime.Puzzle_A
{
    /// <summary>
    /// The main component for the symbol ball module.
    /// </summary>
    public class Ball : ModuleState
    {
        [BoxGroup("Internal")] [Required]
        public Emission statusLight;
        [BoxGroup("Internal")] [Required]
        public Ring ring;

        public bool StatusLight
        {
            set => statusLight.active = value;
        }

        public bool Active
        {
            set
            {
                statusLight.color = value ?
                    Engine.Runtime.Engine.Theme.puzzleColor.hdr
                    : Engine.Runtime.Engine.Theme.solvedColor.hdr;
                ring.rotating = value;
                if (!value)
                {
                    ring.crystal.Active = false;
                    ring.symbols.ForEach(symbol => symbol.Active = false);
                }
            }
        }

        public override void SetModule(Module module) {}
    }
}