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

/// <summary>
///     OPC UA client data-path permissions per <c>acl-design.md</c>.
///     Stored as <c>int</c> bitmask in <see cref="Entities.NodeAcl.PermissionFlags"/>.
/// </summary>
[Flags]
public enum NodePermissions : int
{
    None = 0,

    // Read-side
    Browse = 1 << 0,
    Read = 1 << 1,
    Subscribe = 1 << 2,
    HistoryRead = 1 << 3,

    // Write-side (mirrors v1 SecurityClassification model)
    WriteOperate = 1 << 4,
    WriteTune = 1 << 5,
    WriteConfigure = 1 << 6,

    // Alarm-side
    AlarmRead = 1 << 7,
    AlarmAcknowledge = 1 << 8,
    AlarmConfirm = 1 << 9,
    AlarmShelve = 1 << 10,

    // OPC UA Part 4 §5.11
    MethodCall = 1 << 11,

    // OPC UA HistoryUpdate (annotation / insert / delete) — separate from HistoryRead so a
    // read-only grant cannot authorize historian writes. Not included in any composite bundle
    // until the HistoryUpdate service surface is implemented.
    HistoryUpdate = 1 << 12,

    // Bundles (one-click grants in Admin UI)
    ReadOnly = Browse | Read | Subscribe | HistoryRead | AlarmRead,
    Operator = ReadOnly | WriteOperate | AlarmAcknowledge | AlarmConfirm,
    Engineer = Operator | WriteTune | AlarmShelve,
    Admin = Engineer | WriteConfigure | MethodCall,
}
