using System;
using System.Collections.Generic;
using System.Linq;
using PkmnLibSharp.Utilities;

namespace PkmnLibSharp.Battling
{
    public class ExperienceLibrary : PointerWrapper
    {
        public ExperienceLibrary(IntPtr ptr) : base(ptr)
        {
        }

        public ExperienceLibrary() : base(Pkmnlib.Generated.ExperienceLibrary.Construct())
        {
        }

        void HandleExperienceGain(Pokemon faintedMon, IReadOnlyCollection<Pokemon> opponents)
        {
            Pkmnlib.Generated.ExperienceLibrary.HandleExperienceGain(Ptr, faintedMon.Ptr, 
                opponents.Select(x => x.Ptr).ToArray().ArrayPtr(),
                (ulong) opponents.Count);
        }

        protected override void DeletePtr()
        {
            Pkmnlib.Generated.ExperienceLibrary.Destruct(Ptr);
        }
    }
}