using System.Reflection;

using Newtonsoft.Json;
using Newtonsoft.Json.Serialization;

namespace BeWoPlanerMobil.Util
{
	public class ShouldSerializeContractResolver : DefaultContractResolver
	{
		protected override JsonProperty CreateProperty(MemberInfo member, MemberSerialization memberSerialization)
		{
			var property = base.CreateProperty(member, memberSerialization);

			if (property.PropertyName.Equals("ObjVersionValue") || property.PropertyName.Equals("DefaultAddress"))
				property.ShouldSerialize = instance => false;

			return property;
		}
	}
}