using ZB.MOM.WW.ScadaBridge.CentralUI.ScriptAnalysis;
namespace ZB.MOM.WW.ScadaBridge.CentralUI.Components.Shared;
///
/// Parses the parameter-definitions JSON Schema written by SchemaBuilder and
/// returns the declared parameter names (and shapes). Used by script-edit
/// pages to feed the Monaco editor's Parameters["..."] context.
///
public static class ScriptParameterNames
{
///
/// Parses a parameter definitions JSON Schema and returns the declared parameter names.
///
/// JSON Schema or legacy flat-array string; null/empty returns an empty list.
/// A read-only list of declared parameter names.
public static IReadOnlyList Parse(string? json) =>
JsonSchemaShapeParser.ParseParameters(json)
.Select(p => p.Name)
.Where(s => !string.IsNullOrEmpty(s))
.ToList();
///
/// Parses a parameter definitions JSON Schema and returns the full parameter shape objects.
///
/// JSON Schema or legacy flat-array string; null/empty returns an empty list.
/// A read-only list of parameter shape objects with name and type information.
public static IReadOnlyList ParseShapes(string? json) =>
JsonSchemaShapeParser.ParseParameters(json);
}