71 lines
2.5 KiB
C#
71 lines
2.5 KiB
C#
using ZB.MOM.WW.ScadaBridge.Commons.Types.Enums;
|
|
|
|
namespace ZB.MOM.WW.ScadaBridge.Commons.Entities.Templates;
|
|
|
|
public class TemplateAttribute
|
|
{
|
|
/// <summary>
|
|
/// Gets or sets the attribute ID.
|
|
/// </summary>
|
|
public int Id { get; set; }
|
|
/// <summary>
|
|
/// Gets or sets the template ID that owns this attribute.
|
|
/// </summary>
|
|
public int TemplateId { get; set; }
|
|
/// <summary>
|
|
/// Gets or sets the attribute name.
|
|
/// </summary>
|
|
public string Name { get; set; }
|
|
/// <summary>
|
|
/// Gets or sets the attribute value.
|
|
/// </summary>
|
|
public string? Value { get; set; }
|
|
/// <summary>
|
|
/// Gets or sets the data type of the attribute.
|
|
/// </summary>
|
|
public DataType DataType { get; set; }
|
|
/// <summary>
|
|
/// For <see cref="Enums.DataType.List"/> attributes: the scalar type of each
|
|
/// element (String, Int32, Float, Double, Boolean, DateTime). Null for scalar
|
|
/// attributes. The element type is fixed by the base attribute and cannot be
|
|
/// changed on a derived template or instance override.
|
|
/// </summary>
|
|
public DataType? ElementDataType { get; set; }
|
|
/// <summary>
|
|
/// Gets or sets a value indicating whether the attribute is locked from override.
|
|
/// </summary>
|
|
public bool IsLocked { get; set; }
|
|
/// <summary>
|
|
/// Gets or sets the attribute description.
|
|
/// </summary>
|
|
public string? Description { get; set; }
|
|
/// <summary>
|
|
/// Gets or sets the data source reference for this attribute.
|
|
/// </summary>
|
|
public string? DataSourceReference { get; set; }
|
|
|
|
/// <summary>
|
|
/// 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.
|
|
/// </summary>
|
|
public bool IsInherited { get; set; }
|
|
|
|
/// <summary>
|
|
/// Set on a base attribute. When true, derived templates may not override
|
|
/// the value — the row is rendered readonly with a 🔒 in the derived UI,
|
|
/// and any attempt to update it through the API is rejected.
|
|
/// </summary>
|
|
public bool LockedInDerived { get; set; }
|
|
|
|
/// <summary>
|
|
/// Initializes a new instance of the <see cref="TemplateAttribute"/> class with the specified name.
|
|
/// </summary>
|
|
/// <param name="name">The attribute name.</param>
|
|
public TemplateAttribute(string name)
|
|
{
|
|
Name = name ?? throw new ArgumentNullException(nameof(name));
|
|
}
|
|
}
|