using System.Collections.Generic;
using Newtonsoft.Json;
using Newtonsoft.Json.Converters;
using VCommon.Json;

namespace VCommon.VOpenApi.Json
{
    internal class JsonReturnValueSerializer
    {
        private readonly IVJsonSerializer _jsonSerializer = new VJsonSerializer(new JsonSerializerSettings
        {
            NullValueHandling = NullValueHandling.Ignore,
            Converters = new List<JsonConverter> { new StringEnumConverter() },
            ContractResolver = new JsonReturnValueContractResolver(),
        });

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