namespace AyCode.Core.Serializers.Binaries;

/// <summary>
/// Controls string interning for a specific property during binary serialization.
/// When StringInterningMode is Attribute: only properties with [AcStringIntern(true)] are interned.
/// When StringInterningMode is All: properties with [AcStringIntern(false)] opt-out from interning.
/// Attribute is inherited from base class properties if not explicitly specified.
/// </summary>
[AttributeUsage(AttributeTargets.Property, Inherited = true, AllowMultiple = false)]
public sealed class AcStringInternAttribute : Attribute
{
    /// <summary>
    /// Whether string interning is enabled for this property.
    /// </summary>
    public bool Enabled { get; }

    /// <summary>
    /// Creates a new AcStringInternAttribute.
    /// </summary>
    /// <param name="enabled">True to enable interning, false to disable.</param>
    public AcStringInternAttribute(bool enabled)
    {
        Enabled = enabled;
    }
}
