using ZB.MOM.WW.ScadaBridge.Commons.Types.Enums;
namespace ZB.MOM.WW.ScadaBridge.Commons.Entities.Templates;
public class TemplateAttribute
{
///
/// Gets or sets the attribute ID.
///
public int Id { get; set; }
///
/// Gets or sets the template ID that owns this attribute.
///
public int TemplateId { get; set; }
///
/// Gets or sets the attribute name.
///
public string Name { get; set; }
///
/// Gets or sets the attribute value.
///
public string? Value { get; set; }
///
/// Gets or sets the data type of the attribute.
///
public DataType DataType { get; set; }
///
/// For 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.
///
public DataType? ElementDataType { get; set; }
///
/// Gets or sets a value indicating whether the attribute is locked from override.
///
public bool IsLocked { get; set; }
///
/// Gets or sets the attribute description.
///
public string? Description { get; set; }
///
/// Gets or sets the data source reference for this attribute.
///
public string? DataSourceReference { 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 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.
///
public bool LockedInDerived { get; set; }
///
/// Initializes a new instance of the class with the specified name.
///
/// The attribute name.
public TemplateAttribute(string name)
{
Name = name ?? throw new ArgumentNullException(nameof(name));
}
}