using System.Collections.Generic;
using Intrepid.Core.Camera.Events;
using Intrepid.Core.Entities;
using Intrepid.Core.Tags;
using Intrepid.GameManagers;
using Intrepid.Utilities;
using UnityEngine;

namespace Intrepid.Core.Camera
{
    public class CameraProximityTrigger : EntityTrigger
    {
        [GroupConfigurations, SerializeField] private CameraZoomLevel zoomLevel = CameraZoomLevel.ZoomIn;
        [GroupConfigurations, SerializeField, Range(.05f, 3f)] private float enterZoomVelocity = .5f;
        [GroupConfigurations, SerializeField, Range(.05f, 3f)] private float exitZoomVelocity = .5f;
        
        protected override void WhenRaiseEnterEvent(Collider other, EntitySensor entitySensor, List<BehaviourTag> behaviourTags)
        {
            Proxy.Instance.EventBus.Raise(new CameraZoomEvent
            {
                ZoomLevel = zoomLevel,
                ZoomVelocity = enterZoomVelocity
            });
        }

        protected override void WhenRaiseExitEvent(Collider other, EntitySensor entitySensor)
        {
            Proxy.Instance.EventBus.Raise(new CameraZoomEvent
            {
                ZoomLevel = CameraZoomLevel.None,
                ZoomVelocity = exitZoomVelocity
            });
        }
    }
}