@page "/dev/tiamgridexample"

@using TIAMWebApp.Shared.Application.Interfaces;
@using TIAMWebApp.Shared.Application.Models;
@using TIAMSharedUI.Shared.Components;
@using TIAMSharedUI.Shared.AcComponents;

@inject IWeatherForecastService WeatherForecastService;

<TiamDxGridBase Data="Forecasts" Settings="InputAttributes">
    <DxGridCommandColumn Width="150px" />
    <DxGridDataColumn FieldName="@nameof(WeatherForecast.Date)"></DxGridDataColumn>
    <DxGridDataColumn FieldName="@nameof(WeatherForecast.TemperatureC)"></DxGridDataColumn>
    <DxGridDataColumn FieldName="@nameof(WeatherForecast.TemperatureF)"></DxGridDataColumn>
    <DxGridDataColumn FieldName="@nameof(WeatherForecast.Summary)"></DxGridDataColumn>
</TiamDxGridBase>

@code {

    public List<WeatherForecast>? Forecasts { get; set; }
    public Dictionary<string, object> InputAttributes { get; set; } =
        new Dictionary<string, object>() {
            { "PageSize", 5 },
            { "ShowFilterRow", false },
            { "PagerVisible" , false },
            { "ShowGroupPanel", true }
        };
    protected override async Task OnInitializedAsync() {
        base.OnInitialized();
        WeatherForecast[]? data = await WeatherForecastService.GetWeatherForecastAsync();
        Forecasts = data.ToList();
    }
}