using System;
using PkmnLibSharp.Utilities;

namespace PkmnLibSharp.Battling.ChoiceTurn
{
    public abstract class BaseTurnChoice : PointerWrapper
    {
        protected BaseTurnChoice(IntPtr ptr) : base(ptr){}
        
        public TurnChoiceKind Kind => (TurnChoiceKind) Creaturelib.Generated.BaseTurnChoice.GetKind(Ptr);

        public Pokemon User
        {
            get
            {
                if (_user != null) return _user;
                var ptr = Creaturelib.Generated.BaseTurnChoice.GetUser(Ptr);
                if (TryResolvePointer(ptr, out _user))
                    return _user!;
                _user = Constructor.Active.ConstructPokemon(ptr)!;
                return _user;
            }
        }

        private Pokemon? _user;
    }
}