using System.Reflection;
using AyCode.Services.SignalRs;

namespace AyCode.Models.Server.DynamicMethods;

public class AcMethodInfoModel<TAttribute> where TAttribute : TagAttribute
{
    public ParameterInfo[]? ParamInfos { get; init; } = null;
    public TAttribute Attribute { get; init; }
    public MethodInfo MethodInfo { get; init; }

    public AcMethodInfoModel(TAttribute attribute, MethodInfo methodInfo)
    {
        Attribute = attribute;
        MethodInfo = methodInfo;

        var parameters = methodInfo.GetParameters();

        //if (parameters.Length > 1)
        //    throw new Exception("MethodInfoModel; parameters.Length > 1");

        ParamInfos = parameters;
    }
}