namespace ScadaLink.CentralUI.ScriptAnalysis;

/// <summary>
/// Parses the parameter-definitions and return-definition JSON Schema written
/// by SchemaBuilder into a <see cref="ScriptShape"/>. Delegates to
/// <see cref="JsonSchemaShapeParser"/>, which also handles legacy flat-shape
/// rows during the transition window.
/// </summary>
public static class ScriptShapeParser
{
    public static ScriptShape Parse(string name, string? parametersJson, string? returnJson)
    {
        var parameters = JsonSchemaShapeParser.ParseParameters(parametersJson);
        var returnType = JsonSchemaShapeParser.ParseReturnType(returnJson);
        return new ScriptShape(name, parameters, returnType);
    }
}
