using System.Windows;
using InABox.Core;
using Syncfusion.Data;
using Syncfusion.UI.Xaml.Grid;
using Syncfusion.UI.Xaml.Grid.Cells;
using Syncfusion.UI.Xaml.TreeGrid;

namespace InABox.DynamicGrid;

public class DynamicGridIntegerColumn : DynamicGridNumericColumn< IntegerEditor, GridNumericColumn, TreeGridNumericColumn>
{
    protected override void Configure(GridNumericColumn column, IntegerEditor editor)
    {
        column.NumberGroupSeparator = "";
        column.NumberDecimalDigits = 0;
    }
    protected override void Configure(TreeGridNumericColumn column, IntegerEditor editor)
    {
        column.NumberGroupSeparator = "";
        column.NumberDecimalDigits = 0;
    }
    
    public override IDynamicGridSummary? Summary()
    {
        if (Definition.Editor.Summary == Core.Summary.None)
            return null;
        
        return Definition.Editor.Summary == Core.Summary.Sum
            ? new DynamicGridSumSummary<int>($"N{Editor!.Digits}")
            : new DynamicGridCountSummary();
    }

    public DynamicGridIntegerColumn(DynamicGridColumn definition) : base(definition)
    {
    }
}