namespace ScadaLink.Commons.Entities.Templates;
public class TemplateScript
{
///
/// The script identifier.
///
public int Id { get; set; }
///
/// The template identifier this script belongs to.
///
public int TemplateId { get; set; }
///
/// The script name.
///
public string Name { get; set; }
///
/// Whether the script is locked for editing.
///
public bool IsLocked { get; set; }
///
/// The script code.
///
public string Code { get; set; }
///
/// The trigger type for the script, or null.
///
public string? TriggerType { get; set; }
///
/// The trigger configuration, or null.
///
public string? TriggerConfiguration { get; set; }
///
/// The parameter definitions in JSON format, or null.
///
public string? ParameterDefinitions { get; set; }
///
/// The return type definition in JSON format, or null.
///
public string? ReturnDefinition { get; set; }
///
/// The minimum time between script runs, or null.
///
public TimeSpan? MinTimeBetweenRuns { get; set; }
///
/// True when this row was copied from the base template and has not been
/// overridden on the derived template. Changes to the base flow downward
/// for inherited rows; an explicit override flips this to false.
/// Always false on base (non-derived) templates.
///
public bool IsInherited { get; set; }
///
/// Set on a base script. When true, derived templates may not override
/// the script body — the row is rendered readonly in the derived
/// UI, and any attempt to update it through the API is rejected.
///
public bool LockedInDerived { get; set; }
///
/// Initializes a new instance of the TemplateScript.
///
/// The script name.
/// The script code.
public TemplateScript(string name, string code)
{
Name = name ?? throw new ArgumentNullException(nameof(name));
Code = code ?? throw new ArgumentNullException(nameof(code));
}
}