@inherits ComponentBase

<TableContainer T="HostInterfaceEntity"
                @ref="Container"
                @bind-Search="Search"
                Title="@Title"
                Breadcrumbs="@Breadcrumbs"
                Data="LoadDataAsync">
    <Header>
        <MudTh>
            <MudTableSortLabel SortLabel="Name" T="HostInterfaceEntity">
                Name
            </MudTableSortLabel>
        </MudTh>
        <MudTh>
            <MudTableSortLabel SortLabel="Description" T="HostInterfaceEntity">
                Adapter
            </MudTableSortLabel>
        </MudTh>
        <MudTh>
            <MudTableSortLabel SortLabel="Mac" T="HostInterfaceEntity">
                Mac
            </MudTableSortLabel>
        </MudTh>
        <MudTh>
            <MudTableSortLabel SortLabel="Speed" T="HostInterfaceEntity">
                Speed
            </MudTableSortLabel>
        </MudTh>
        <MudTh>
            <MudTableSortLabel SortLabel="Sent" T="HostInterfaceEntity">
                Sent
            </MudTableSortLabel>
        </MudTh>
        <MudTh>
            <MudTableSortLabel SortLabel="Received" T="HostInterfaceEntity">
                Received
            </MudTableSortLabel>
        </MudTh>
        <MudTh>
            <MudTableSortLabel SortLabel="Status" T="HostInterfaceEntity">
                Status
            </MudTableSortLabel>
        </MudTh>
    </Header>
    <RowTemplate>
        <MudTd DataLabel="Name">
            <MudLink Href="@Navigation.Management.Hosts.Network.Interfaces.DetailsHref(HostId, context?.Id.ToString())" Typo="Typo.inherit" Underline="Underline.None">
                @context?.Name
            </MudLink>
        </MudTd>
        <MudTd DataLabel="Adapter">
            @context?.Description
        </MudTd>
        <MudTd DataLabel="Mac">
            @context?.Mac
        </MudTd>
        <MudTd DataLabel="Speed">
            @if (context?.Speed is not null)
            {
                @($"{Math.Round((context.Speed.Value / Math.Pow(1000, 3)), 2)} GBit/s")
            }
        </MudTd>
        <MudTd DataLabel="Sent">
            @if (context?.Sent is not null)
            {
                @($"{Math.Round((context.Sent.Value / Math.Pow(1000, 3)), 2)} GB")
            }
        </MudTd>
        <MudTd DataLabel="Received">
            @if (context?.Received is not null)
            {
                @($"{Math.Round((context.Received.Value / Math.Pow(1000, 3)), 2)} GB")
            }
        </MudTd>
        <MudTd DataLabel="Status">
            @if (context?.Status is not null && Enum.TryParse<System.Net.NetworkInformation.OperationalStatus>(context.Status, true, out var operationalStatus))
            {
                var color = operationalStatus == System.Net.NetworkInformation.OperationalStatus.Up ? Color.Success : Color.Error;

                <MudText Color="color" Typo="Typo.inherit">
                    @context?.Status
                </MudText>
            }
            else
            {
                @("Unknown")
            }
        </MudTd>
    </RowTemplate>
</TableContainer>