// Copyright (c) Microsoft. All rights reserved.
// Licensed under the MIT License.

// <auto-generated/>

#nullable disable

using System;

namespace Microsoft.TypeSpec.Generator.Customizations
{
    [AttributeUsage((AttributeTargets.Class | AttributeTargets.Struct), AllowMultiple = true, Inherited = true)]
    internal partial class CodeGenSerializationAttribute : Attribute
    {
        /// <param name="propertyName"> The property name which these hooks apply to. </param>
        public CodeGenSerializationAttribute(string propertyName)
        {
            PropertyName = propertyName;
        }

        /// <param name="propertyName"> The property name which these hooks apply to. </param>
        /// <param name="serializationName"> The serialization name of the property. </param>
        public CodeGenSerializationAttribute(string propertyName, string serializationName)
        {
            PropertyName = propertyName;
            SerializationName = serializationName;
        }

        /// <summary> Gets or sets the property name which these hooks should apply to. </summary>
        public string PropertyName { get; }

        /// <summary> Gets or sets the serialization name of the property. </summary>
        public string SerializationName { get; set; }

        /// <summary>
        /// Gets or sets the method name to use when serializing the property value (property name excluded).
        /// The signature of the serialization hook method must be or compatible with when invoking: private void SerializeHook(Utf8JsonWriter writer);
        /// </summary>
        public string SerializationValueHook { get; set; }

        /// <summary>
        /// Gets or sets the method name to use when deserializing the property value from the JSON.
        /// private static void DeserializationHook(JsonProperty property, ref TypeOfTheProperty propertyValue); // if the property is required
        /// private static void DeserializationHook(JsonProperty property, ref Optional&lt;TypeOfTheProperty&gt; propertyValue); // if the property is optional
        /// </summary>
        public string DeserializationValueHook { get; set; }
    }
}
