using Newtonsoft.Json;
using Newtonsoft.Json.Converters;
using VCommon.Json;

namespace VCommon.VApplication.Auditing.Json
{
    internal class JsonAuditLogSerializer
    {
        private readonly IVJsonSerializer _jsonSerializer = new VJsonSerializer(new JsonSerializerSettings
        {
            NullValueHandling = NullValueHandling.Ignore,
            Converters = new JsonConverter[]
            {
                new StringEnumConverter()
            },
            ContractResolver = new JsonAuditLogContractResolver(),
        });

        public string SerializeObject(object obj) => _jsonSerializer.SerializeObject(obj);
    }
}
