// Generated by @typespec/http-server-csharp
// <auto-generated />
#nullable enable

using System.Text.Json;
using System.Text.Json.Serialization;

namespace TypeSpec.Helpers
{
    /// <summary>
    /// Interface for Json serialization, suitable for providing a service in ASP.Net dependency injection
    /// </summary>
    public interface IJsonSerializationProvider
    {
        /// <summary>
        /// Serialize an object to a JSON string
        /// </summary>
        /// <typeparam name="T">The type of the object</typeparam>
        /// <param name="value">The object to serialize</param>
        /// <returns>A string representing the serialized object</returns>
        string Serialize<T>(T value);

        /// <summary>
        /// Create an object from a json string
        /// </summary>
        /// <typeparam name="T">The type of the object represented in the string</typeparam>
        /// <param name="value">The strign to deserialize</param>
        /// <returns>The deserialized object, or null</returns>
        T? Deserialize<T>(string value);
    }
}
