using System;
using PkmnLibSharp.Utilities;

namespace PkmnLibSharp.Library.GrowthRates
{
    public class GrowthRateLibrary : PointerWrapper
    {
        internal GrowthRateLibrary(IntPtr ptr) : base(ptr)
        {
        }

        public GrowthRateLibrary(ulong initialCapacity) : base(
            Creaturelib.Generated.GrowthRateLibrary.Construct(initialCapacity))
        {
        }

        public byte CalculateLevel(string growthRateName, uint experience)
        {
            byte b = 0;
            Creaturelib.Generated.GrowthRateLibrary.CalculateLevel(ref b, Ptr, growthRateName.ToPtr(),
                experience).Assert();
            return b;
        }
        public uint CalculateExperience(string growthRateName, byte level)
        {
            uint i = 0;
            Creaturelib.Generated.GrowthRateLibrary.CalculateExperience(ref i, Ptr, growthRateName.ToPtr(),
                level).Assert();
            return i;
        }

        public void AddGrowthRate(string name, GrowthRate gr)
        {
            Creaturelib.Generated.GrowthRateLibrary.AddGrowthRate(Ptr, name.ToPtr(), gr.Ptr).Assert();
        }
        
        protected override void DeletePtr()
        {
            Creaturelib.Generated.GrowthRateLibrary.Destruct(Ptr);
        }
    }
}