using System.Collections.Generic;
using UnityEngine;

namespace GGJ.Models
{
    public enum DraggableType
    {
        ConcaveLens,
        ConvexLens,
        Mirror,
        Prisma,
        PitMirror,
        BumpMirror,
        Filter
    }

    public enum LightProperties
    {
        Normal,
        Filter,
    }

    public abstract class BaseDraggable : MonoBehaviour
    {
        public virtual DraggableType DraggableType
        {
            get { return DraggableType.Mirror; }
        }

        public virtual LightProperties LightProperties
        {
            get { return LightProperties.Normal; }
        }

        public virtual Color FilterColor
        {
            get { return Color.white; }
        }

        public float[] verticalSnap;
        public float[] horizontalSnap;
        public bool isInsideGrid;
        public bool inputInactive = false;

        public virtual Light HitLight(List<Light> incoming, RaycastHit2D hit)
        {
            return null;
        }

        void OnMouseDown()
        {
            if (inputInactive) return;
            var distance = Vector3.Distance(transform.position, Camera.main.transform.position);
            InputManager.instance.Activate(this);
            InputManager.instance.StartDragging(distance);
        }

        void OnMouseUp()
        {
            if (inputInactive) return;
            InputManager.instance.EndDragging();
        }
    }
}