namespace ZB.MOM.WW.ScadaBridge.Commons.Entities.InboundApi;
public class ApiMethod
{
/// Gets or sets the primary key.
public int Id { get; set; }
/// Gets or sets the method name used in the route (/api/{Name}).
public string Name { get; set; }
/// Gets or sets the C# script body executed when the method is invoked.
public string Script { get; set; }
/// Gets or sets the JSON-serialised list of API key IDs approved for this method, or null for unrestricted.
public string? ApprovedApiKeyIds { get; set; }
/// Gets or sets the JSON Schema describing the accepted parameters, or null if the method takes no parameters.
public string? ParameterDefinitions { get; set; }
/// Gets or sets the JSON Schema describing the return type, or null if the method returns nothing.
public string? ReturnDefinition { get; set; }
/// Gets or sets the script execution timeout in seconds.
public int TimeoutSeconds { get; set; }
/// Initializes a new with the required name and script.
/// The method name (used as the route segment).
/// The C# script body to execute.
public ApiMethod(string name, string script)
{
Name = name ?? throw new ArgumentNullException(nameof(name));
Script = script ?? throw new ArgumentNullException(nameof(script));
}
}