using DevExpress.Blazor;
using FruitBank.Common.Dtos;
using FruitBank.Common.Interfaces;
using FruitBank.Common.SignalRs;
using Microsoft.AspNetCore.Components;

namespace FruitBankHybrid.Shared.Components.Grids.Products;

public class GridStockQuantityHistoryDtoBase : FruitBankGridBase<StockQuantityHistoryDto>, IGrid
{
    public GridStockQuantityHistoryDtoBase() : base()
    {
    }

    protected override async Task OnInitializedAsync()
    {
        if (GetAllMessageTag > 0) return;

        if (IsMasterGrid) GetAllMessageTag = SignalRTags.GetStockQuantityHistoryDtos;
        else
        {
            if (ContextIds == null || ContextIds.Length == 0) ContextIds = [ParentDataItem!.Id];

            if (ParentDataItem is IProductDto) GetAllMessageTag = SignalRTags.GetStockQuantityHistoryDtosByProductId;
            //else if (ParentDataItem is IShipping) GetAllMessageTag = SignalRTags.GetShippingItemsByShippingId;
        }

        await base.OnInitializedAsync();
    }

    protected override Task SetParametersAsyncCore(ParameterView parameters)
    {
        return base.SetParametersAsyncCore(parameters);

        if (!IsFirstInitializeParameters)
        {
            //ShowFilterRow = true;
            //ShowGroupPanel = true;
            //AllowSort = false;

            //etc...
        }
    }
}