using FastReport.Dialog;
using System;
using System.Collections.Generic;
using System.Linq;
using System.Threading.Tasks;

namespace FastReport.Web.Blazor.Components.Internal.Dialog
{
    public class DataFilterBaseComponent<T> : DialogBaseComponent<T> 
        where T : DataFilterBaseControl
    {
        protected bool IsDisabled
            => !Control.Enabled;

        protected void Refresh()
        {
            if(Control.DetailControl != null)
                WebReport.OnUpdate();
        }

        protected void ControlFilterRefresh()
        {
            Control.FilterData();
            if (Control.DetailControl != null)
            {
                Control.DetailControl.ResetFilter();
                Control.DetailControl.FillData(Control);
            }
        }

        protected override string GetControlAlign()
        {
            if (Control is TextBoxControl textBoxControl)
                return GetEditAlign(textBoxControl.TextAlign);

            return string.Empty;
        }


    }
}
