using HopFrame.Core.Configuration;
namespace HopFrame.Core.Configurators;
///
/// The configurator for the
///
public class PropertyConfigurator(PropertyConfig config) {
/// The internal config that is modified
public PropertyConfig Config { get; } = config;
///
public PropertyConfigurator SetDisplayName(string displayName) {
Config.DisplayName = displayName;
return this;
}
///
public PropertyConfigurator Listable(bool listable) {
Config.Listable = listable;
return this;
}
///
public PropertyConfigurator Sortable(bool sortable) {
Config.Sortable = sortable;
return this;
}
///
public PropertyConfigurator Searchable(bool searchable) {
Config.Searchable = searchable;
return this;
}
///
public PropertyConfigurator Editable(bool editable) {
Config.Editable = editable;
return this;
}
///
public PropertyConfigurator Creatable(bool creatable) {
Config.Creatable = creatable;
return this;
}
///
public PropertyConfigurator SetOrderIndex(int index) {
Config.OrderIndex = index;
return this;
}
///
/// Sets the property type. The predefined modifiers (like nullable) persist.
/// If the property is a list or any other generic type, please use the enumerated type.
///
public PropertyConfigurator SetType(PropertyType type) {
Config.PropertyType = (PropertyType)(((byte)Config.PropertyType & 0xF0) | ((byte)type & 0x0F));
return this;
}
}