using RobotNet.VDA5050.Factsheet; using RobotNet.VDA5050.Type; namespace RobotNet10.RobotApp.Services.Robot.Actions; [AttributeUsage(AttributeTargets.Class, AllowMultiple = false, Inherited = false)] public class RobotActionAttribute : Attribute { public ActionType ActionType { get; } public IReadOnlyList ActionScopes { get; } public IReadOnlyList BlockingTypes { get; } public string? ActionDescription { get; } public string? ResultDescription { get; } public RobotActionAttribute( ActionType actionType, ActionScope[] scopes, BlockingType[] blockingTypes, string? description = null, string? resultDescription = null) { ArgumentNullException.ThrowIfNull(scopes); ArgumentNullException.ThrowIfNull(blockingTypes); if (!Enum.IsDefined(actionType)) { throw new ArgumentException("Invalid action type.", nameof(actionType)); } if (scopes.Length == 0) throw new ArgumentException("Scopes cannot be empty.", nameof(scopes)); if (blockingTypes.Length == 0) throw new ArgumentException("Blocking types cannot be empty.", nameof(blockingTypes)); ActionType = actionType; ActionScopes = Array.AsReadOnly(scopes); BlockingTypes = Array.AsReadOnly(blockingTypes); ActionDescription = description; ResultDescription = resultDescription; } }