using System;
using System.Collections.Generic;

namespace ZB.MOM.WW.MxGateway.Worker.MxAccess;

/// <summary>
///     Advises a set of MXAccess subtag addresses and surfaces value changes.
///     The production implementation owns its own LMXProxyServerClass (later task);
///     tests substitute a fake that pushes SubtagValueChange values.
/// </summary>
public interface ISubtagAlarmSource : IDisposable
{
    /// <summary>Raised when an advised subtag reports a new value.</summary>
    event EventHandler<SubtagValueChange>? ValueChanged;

    /// <summary>Begins advising the supplied MXAccess subtag item addresses.</summary>
    /// <param name="itemAddresses">The subtag references to advise.</param>
    void Advise(IReadOnlyCollection<string> itemAddresses);

    /// <summary>Writes a value to the named MXAccess subtag (e.g. an ack request).</summary>
    /// <param name="itemAddress">The subtag reference to write.</param>
    /// <param name="value">The value to write.</param>
    void Write(string itemAddress, object? value);
}
