using System;
using Robust.Client.ViewVariables.Editors;
namespace Robust.Client.ViewVariables;
///
/// Factory that creates UI controls for viewing variables based on provided property type.
///
[NotContentImplementable]
public interface IViewVariableControlFactory
{
///
/// Creates UI control for viewing variable of type .
/// Returns if fails to find proper control.
/// First will look for control factory by type match (),
/// then will try to check each registered conditional factory
/// (, and similar methods).
///
VVPropEditor CreateFor(Type? type);
///
/// Registers factory method for vv control. This factory method will be used if provided type will be exactly equal to .
///
/// Type of property, for which this control factory should be used. Will only be used in case of exact match.
/// Factory method that creates VV control.
void RegisterForType(Func factoryMethod);
///
/// Registers factory method for vv control. This factory method will be used if provided type will be assignable to .
/// Conditions will be checked if none of registrations were fitting.
///
/// Factory method that creates VV control.
/// Where new condition should be inserted - at start or at the end of the list.
void RegisterForAssignableFrom(Func factoryMethod, InsertPosition insertPosition = InsertPosition.First);
///
/// Registers factory method for vv control. This factory method will be used if will return true for provided type.
/// Conditions will be checked if none of registrations were fitting.
///
/// Condition, that will decide, if factory should be used for provided type.
/// Factory method that creates VV control.
/// Where new condition should be inserted - at start or at the end of the list.
void RegisterWithCondition(Func condition, Func factory, InsertPosition insertPosition = InsertPosition.First);
}
///
/// Indicator, where item should be inserted in list.
///
public enum InsertPosition
{
///
/// Item will be inserted as first in list.
///
First,
///
/// Item will be inserted as last in list.
///
Last
}