using Intrepid.Utilities;
using UnityEngine;

namespace Intrepid.Core.Entities
{
    public abstract class ControllableEntityBrain<T> : EntityBrain where T: VirtualEntityController
    {
        [GroupInjections, SerializeField] private T controller;

        protected T EntityController => controller;

        public sealed override void UpdateFromUpdatable()
        {
            RunBeforeUpdate();
            RunOnUpdate();
            RunAfterUpdate();
        }

        public sealed override void LateUpdateFromUpdatable()
        {
            RunOnLateUpdate();
        }

        public sealed override void FixedUpdateFromUpdatable()
        {
            RunOnFixedUpdate();
        }

        protected abstract void RunBeforeUpdate();
        protected abstract void RunOnUpdate();
        protected abstract void RunAfterUpdate();
        protected abstract void RunOnFixedUpdate();
        protected abstract void RunOnLateUpdate();
    }
}