// Port of Go server/reload.go option interface — represents a single detected
// configuration change with category flags for reload handling.
// Reference: golang/nats-server/server/reload.go lines 42-74.

namespace NATS.Server.Configuration;

/// <summary>
/// Represents a single detected configuration change during a hot reload.
/// Category flags indicate what kind of reload action is needed.
/// </summary>
public interface IConfigChange
{
    /// <summary>
    /// The property name that changed (matches NatsOptions property name).
    /// </summary>
    string Name { get; }

    /// <summary>
    /// Whether this change requires reloading the logger.
    /// </summary>
    bool IsLoggingChange { get; }

    /// <summary>
    /// Whether this change requires reloading authorization.
    /// </summary>
    bool IsAuthChange { get; }

    /// <summary>
    /// Whether this change requires reloading TLS configuration.
    /// </summary>
    bool IsTlsChange { get; }

    /// <summary>
    /// Whether this option cannot be changed at runtime (requires restart).
    /// </summary>
    bool IsNonReloadable { get; }
}

/// <summary>
/// Default implementation of <see cref="IConfigChange"/> using a primary constructor.
/// </summary>
public sealed class ConfigChange(
    string name,
    bool isLoggingChange = false,
    bool isAuthChange = false,
    bool isTlsChange = false,
    bool isNonReloadable = false) : IConfigChange
{
    public string Name => name;
    public bool IsLoggingChange => isLoggingChange;
    public bool IsAuthChange => isAuthChange;
    public bool IsTlsChange => isTlsChange;
    public bool IsNonReloadable => isNonReloadable;
}
