using InABox.Wpf;
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using System.Windows;
using System.Windows.Controls;
using System.Windows.Data;
using System.Windows.Documents;
using System.Windows.Input;
using System.Windows.Media;
using System.Windows.Media.Imaging;
using System.Windows.Shapes;
using InABox.Core;

namespace InABox.DynamicGrid
{
    /// <summary>
    /// Interaction logic for DynamicGridFilterEditor.xaml
    /// </summary>
    public partial class DynamicGridFilterEditor : ThemableWindow
    {
        private DynamicGridFilterGrid FilterGrid;

        public DynamicGridFilterEditor(CoreFilterDefinitions Filters, Type filterType)
        {
            InitializeComponent();

            FilterGrid = new DynamicGridFilterGrid(filterType) { Margin = new Thickness(5) };
            FilterGrid.Filters = Filters;
            FilterGrid.Refresh(true, true);

            FilterGrid.SetValue(Grid.RowProperty, 0);
            FilterGrid.SetValue(Grid.ColumnProperty, 0);
            FilterGrid.SetValue(Grid.ColumnSpanProperty, 3);

            Grid.Children.Add(FilterGrid);
        }

        public CoreFilterDefinitions Filters { get => FilterGrid.Filters; }

        private void OKButton_Click(object sender, RoutedEventArgs e)
        {
            DialogResult = true;
        }

        private void CancelButton_Click(object sender, RoutedEventArgs e)
        {
            DialogResult = false;
        }
    }
}
