using InABox.Core;
using InABox.DynamicGrid;
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using System.Windows;

namespace InABox.Wpf
{
    public interface IFilterEditorConfiguration
    {
        public bool HasCustomValue { get; }

        public ICustomValueNode? CreateCustomValueNode(Type T, string? propertyName, Operator op, CustomFilterValue? value);
    }

    public class FilterEditorConfiguration : IFilterEditorConfiguration
    {
        public delegate ICustomValueNode? CreateCustomValueNodeHandler(Type T, string? propertyName, Operator op, CustomFilterValue? value);
        public event CreateCustomValueNodeHandler? OnCreateCustomValueNode;

        public bool HasCustomValue { get => OnCreateCustomValueNode != null; }

        public ICustomValueNode? CreateCustomValueNode(Type T, string? propertyName, Operator op, CustomFilterValue? value)
        {
            return OnCreateCustomValueNode?.Invoke(T, propertyName, op, value);
        }

        public static FilterEditorConfiguration Default()
        {
            return new FilterEditorConfiguration();
        }
    }
}
