using Mapster; using Roadie.Library.Utility; using System; using System.Text.Json.Serialization; namespace Roadie.Library.Models { /// /// Generic Data "Token" (or List Item) for associations and child lists on objects. Example "Genres" for a Release. /// [Serializable] public class DataToken { /// /// Any specific tooltip if none given returns Text /// private string _tooltip; /// /// Any specific or special Css to apply to the item /// public string CssClass { get; set; } public object Data { get; set; } /// /// Is the item disabled /// public bool? Disabled { get; set; } /// /// Is the item selected /// public bool? Selected { get; set; } /// /// This is the Text to show to the user (ie name of genre or artist or label) /// public string Text { get; set; } public string Tooltip { get => _tooltip ?? Text; set => _tooltip = value; } /// /// This is the value to submit or the Key (Guid) of the item /// public string Value { get; set; } /// /// Random int to sort when Random Request /// [AdaptIgnore] [JsonIgnore] public int RandomSortId { get; set; } public DataToken() { RandomSortId = StaticRandom.Instance.Next(); } public override string ToString() { return $"Text [{Text}], Value [{Value}]"; } } }