using Quadarax.Foundation.Core.Data.Diff;

namespace BO.Console.Commands.Workspace.Sync.Diff
{
    internal class DocumentEntry : DiffEntry
    {

        public DocumentEntry()
        {
        }


        public override object GetKey()
        {
            var item = (DocumentItem)Item;
            return item.ArtId.GetValueOrDefault();
        }

        protected override CompareStateEnum OnCompareEquality(DiffEntry other)
        {
            if (other == null || other.Item == null)
                return CompareStateEnum.OtherNull;

            var itemCurrent = (DocumentItem)Item;
            var itemOther = (DocumentItem)other.Item;

            if (itemCurrent.ArtLength == itemOther.ArtLength)
                return CompareStateEnum.Equals;


            return CompareStateEnum.CurrentSmaller;
        }
    }
}
