using Newtonsoft.Json; namespace InnovEnergy.API.DataModel; public abstract record DataElement : IComparable { [JsonProperty(Order = Int32.MinValue + 0)] public String Name { get; set; } = ""; [JsonProperty(Order = Int32.MinValue + 1)] public String Type { get; set; } protected DataElement() { Type = GetType().Name; } public override String ToString() => $"{Type.ToLower()} '{Name}'"; public Int32 CompareTo(DataElement? other) { if (ReferenceEquals(this, other)) return 0; if (ReferenceEquals(null, other)) return 1; return String.Compare(Name, other.Name, StringComparison.InvariantCultureIgnoreCase); } }