A small value object representing the result of a target protection check. It records whether an actor is allowed to act on a target, the actor and target protection levels, and a caller-safe reason string.
namespace SboxSuperuser;
/// <summary>Target-protection result only; command permission and live target availability still require independent checks.</summary>
public sealed class TargetProtectionResult
{
/// <summary>Gets whether protection allows this actor to punish this target.</summary>
public bool IsAllowed { get; }
/// <summary>Gets the actor's effective inherited protection level.</summary>
public int ActorLevel { get; }
/// <summary>Gets the target's effective protection level, including stored offline roles.</summary>
public int TargetLevel { get; }
/// <summary>Gets the decision's caller-safe reason.</summary>
public string Reason { get; }
internal TargetProtectionResult( bool isAllowed, int actorLevel, int targetLevel, string reason )
{
IsAllowed = isAllowed;
ActorLevel = actorLevel;
TargetLevel = targetLevel;
Reason = reason;
}
}