using ZB.MOM.WW.OtOpcUa.Configuration.Entities;

namespace ZB.MOM.WW.OtOpcUa.Configuration.Apply;

/// <summary>
///     Host-supplied callbacks invoked as the applier walks the diff. Callbacks are idempotent on
///     retry (the applier may re-invoke with the same inputs if a later stage fails — nodes
///     register-applied to the central DB only after success). Order: namespace → driver → device →
///     equipment → poll group → tag, with Removed before Added/Modified.
/// </summary>
public sealed class ApplyCallbacks
{
    public Func<EntityChange<Namespace>, CancellationToken, Task>? OnNamespace { get; init; }
    public Func<EntityChange<DriverInstance>, CancellationToken, Task>? OnDriver { get; init; }
    public Func<EntityChange<Device>, CancellationToken, Task>? OnDevice { get; init; }
    public Func<EntityChange<Equipment>, CancellationToken, Task>? OnEquipment { get; init; }
    public Func<EntityChange<PollGroup>, CancellationToken, Task>? OnPollGroup { get; init; }
    public Func<EntityChange<Tag>, CancellationToken, Task>? OnTag { get; init; }
}
