using System; using System.Collections.Generic; using Artemis.Core; using Artemis.Core.Modules; using Artemis.UI.Shared.DataModelVisualization; using Artemis.UI.Shared.DataModelVisualization.Shared; namespace Artemis.UI.Shared.Services; /// /// A service for UI related data model tasks /// public interface IDataModelUIService : IArtemisSharedUIService { /// /// Gets a read-only list of all registered data model editors /// IReadOnlyCollection RegisteredDataModelEditors { get; } /// /// Gets a read-only list of all registered data model displays /// IReadOnlyCollection RegisteredDataModelDisplays { get; } /// /// Creates a data model visualization view model for the main data model /// /// /// A data model visualization view model containing all data model expansions and modules that expand the main /// data model /// DataModelPropertiesViewModel GetMainDataModelVisualization(); /// /// Creates a data model visualization view model for the data model of the provided plugin feature /// /// The modules to create the data model visualization view model for /// /// Whether or not also to include the main data model (and therefore any modules marked /// as ) /// /// A data model visualization view model containing the data model of the provided feature DataModelPropertiesViewModel? GetPluginDataModelVisualization(List modules, bool includeMainDataModel); /// /// Updates the children of the provided main data model visualization, removing disabled children and adding newly /// enabled children /// void UpdateModules(DataModelPropertiesViewModel mainDataModelVisualization); /// /// Registers a new data model editor /// /// The type of the editor /// The plugin this editor belongs to /// A collection of extra types this editor supports /// A registration that can be used to remove the editor DataModelVisualizationRegistration RegisterDataModelInput(Plugin plugin, IReadOnlyCollection compatibleConversionTypes) where T : DataModelInputViewModel; /// /// Registers a new data model display /// /// The type of the display /// The plugin this display belongs to /// A registration that can be used to remove the display DataModelVisualizationRegistration RegisterDataModelDisplay(Plugin plugin) where T : DataModelDisplayViewModel; /// /// Removes a data model editor /// /// /// The registration of the editor as returned by /// void RemoveDataModelInput(DataModelVisualizationRegistration registration); /// /// Removes a data model display /// /// /// The registration of the display as returned by /// void RemoveDataModelDisplay(DataModelVisualizationRegistration registration); /// /// Creates the most appropriate display view model for the provided that can display /// a value /// /// The type of data model property to find a display view model for /// The description of the data model property /// /// If , a simple .ToString() display view model will be /// returned if nothing else is found /// /// The most appropriate display view model for the provided DataModelDisplayViewModel? GetDataModelDisplayViewModel(Type propertyType, DataModelPropertyAttribute? description, bool fallBackToDefault = false); /// /// Creates the most appropriate input view model for the provided that allows /// inputting a value /// /// The type of data model property to find a display view model for /// The description of the data model property /// The initial value to show in the input /// A function to call whenever the input was updated (submitted or not) /// The most appropriate input view model for the provided DataModelInputViewModel? GetDataModelInputViewModel(Type propertyType, DataModelPropertyAttribute? description, object? initialValue, Action updateCallback); /// /// Gets a boolean indicating whether or not to show full paths when displaying data model paths. /// PluginSetting ShowFullPaths { get; } /// /// Gets a boolean indicating whether or not to show values when displaying data model paths. /// PluginSetting ShowDataModelValues { get; } }