using System.Windows;
using System.Windows.Controls;

namespace MECF.Framework.UI.Client.CenterViews.Configs.SystemConfig;

public class DisplayValueTemplateSelector : DataTemplateSelector
{
    public DataTemplate ColorDisplayTemplate { get; set; }
    public DataTemplate TextDisplayTemplate { get; set; }
    
    public override DataTemplate SelectTemplate(object item, DependencyObject container)
    {
        if (item is not ConfigItem cfgItem)
            return null;

       
        DataTemplate curTemplate = null;
        switch (cfgItem.Type)
        {
            case DataType.Color:
                curTemplate = ColorDisplayTemplate;
                break;
            
            default:
                curTemplate = TextDisplayTemplate;
                break;
            
        }

        return curTemplate;
    }
}