using NUnit.Framework;
using PkmnLibSharp.Library;
using PkmnLibSharp.Library.Moves;

namespace PkmnLibSharpTests.Library
{
    public class MoveDataTests
    {
        [Test]
        public void ConstructDestruct()
        {
            var move = new MoveData("foobar", 0, MoveCategory.Physical, 60, 100, 20, MoveTarget.Adjacent, 1,
                0, "", new EffectParameter[0], new string[0]);
            move.Dispose();
        }
        
        [Test]
        public void GetName()
        {
            var move = new MoveData("foobar", 0, MoveCategory.Physical, 60, 100, 20, MoveTarget.Adjacent, 1,
                0, "", new EffectParameter[0], new string[0]);
            Assert.AreEqual("foobar", move.Name);
            move.Dispose();
        }

        [Test]
        public void GetTypeProp()
        {
            var move = new MoveData("foobar", 0, MoveCategory.Physical, 60, 100, 20, MoveTarget.Adjacent, 1,
                0, "", new EffectParameter[0], new string[0]);
            Assert.AreEqual(0, move.Type);
            move.Dispose();
        }

        [Test]
        public void GetCategory()
        {
            var move = new MoveData("foobar", 0, MoveCategory.Physical, 60, 100, 20, MoveTarget.Adjacent, 1,
                0, "", new EffectParameter[0], new string[0]);
            Assert.AreEqual(MoveCategory.Physical, move.Category);
            move.Dispose();
        }

        [Test]
        public void GetBasePower()
        {
            var move = new MoveData("foobar", 0, MoveCategory.Physical, 60, 100, 20, MoveTarget.Adjacent, 1,
                0, "", new EffectParameter[0], new string[0]);
            Assert.AreEqual(60, move.BasePower);
            move.Dispose();
        }
        
        [Test]
        public void GetAccuracy()
        {
            var move = new MoveData("foobar", 0, MoveCategory.Physical, 60, 100, 20, MoveTarget.Adjacent, 1,
                0, "", new EffectParameter[0], new string[0]);
            Assert.AreEqual(100, move.Accuracy);
            move.Dispose();
        }

        [Test]
        public void GetBaseUsages()
        {
            var move = new MoveData("foobar", 0, MoveCategory.Physical, 60, 100, 20, MoveTarget.Adjacent, 1,
                0, "", new EffectParameter[0], new string[0]);
            Assert.AreEqual(20, move.BaseUsages);
            move.Dispose();
        }

        [Test]
        public void GetTarget()
        {
            var move = new MoveData("foobar", 0, MoveCategory.Physical, 60, 100, 20, MoveTarget.Adjacent, 1,
                0, "", new EffectParameter[0], new string[0]);
            Assert.AreEqual(MoveTarget.Adjacent, move.Target);
            move.Dispose();
        }

        [Test]
        public void GetPriority()
        {
            var move = new MoveData("foobar", 0, MoveCategory.Physical, 60, 100, 20, MoveTarget.Adjacent, 1,
                0, "", new EffectParameter[0], new string[0]);
            Assert.AreEqual(1, move.Priority);
            move.Dispose();
        }

        [Test]
        public void GetEffectChance()
        {
            var move = new MoveData("foobar", 0, MoveCategory.Physical, 60, 100, 20, MoveTarget.Adjacent, 1,
                0.5f, "", new EffectParameter[0], new string[0]);
            Assert.AreEqual(0.5f, move.SecondaryEffectChance);
            move.Dispose();
        }

        [Test]
        public void GetEffectChanceName()
        {
            var move = new MoveData("foobar", 0, MoveCategory.Physical, 60, 100, 20, MoveTarget.Adjacent, 1,
                0.5f, "test", new EffectParameter[0], new string[0]);
            Assert.AreEqual("test", move.SecondaryEffectName);
            move.Dispose();
        }
        
        [Test]
        public void HasSecondaryEffect()
        {
            var move = new MoveData("foobar", 0, MoveCategory.Physical, 60, 100, 20, MoveTarget.Adjacent, 1,
                0.5f, "test", new EffectParameter[0], new string[0]);
            Assert.True(move.HasSecondaryEffect);
            move.Dispose();
            move = new MoveData("foobar", 0, MoveCategory.Physical, 60, 100, 20, MoveTarget.Adjacent, 1,
                0.5f, "", new EffectParameter[0], new string[0]);
            Assert.False(move.HasSecondaryEffect);
            move.Dispose();
        }


        [Test]
        public void HasFlag()
        {
            var move = new MoveData("foobar", 0, MoveCategory.Physical, 60, 100, 20, MoveTarget.Adjacent, 1,
                0.5f, "test", new EffectParameter[0], new []{"flag1"});
            Assert.True(move.HasFlag("flag1"));
            Assert.False(move.HasFlag("flag2"));
            move.Dispose();
        }

    }
}