using System.Linq.Expressions; using System.Reflection; namespace HopFrame.Core.Config; public class PropertyConfig(PropertyInfo info) { public PropertyInfo Info { get; init; } = info; public string Name { get; set; } = info.Name; public bool List { get; set; } = true; public bool Sortable { get; set; } = true; public bool Searchable { get; set; } = true; public PropertyInfo? DisplayedProperty { get; set; } } public class PropertyConfig(PropertyConfig config) { public PropertyConfig SetDisplayName(string displayName) { config.Name = displayName; return this; } public PropertyConfig List(bool display) { config.List = display; config.Searchable = false; return this; } public PropertyConfig Sortable(bool sortable) { config.Sortable = sortable; return this; } public PropertyConfig Searchable(bool searchable) { config.Searchable = searchable; return this; } public PropertyConfig DisplayedProperty(Expression> propertyExpression) { config.DisplayedProperty = TableConfig.GetPropertyInfo(propertyExpression); return this; } }