@inherits ComponentBase

<BaseContainer Title="@Title" Breadcrumbs="@Breadcrumbs" LoadData="LoadDataAsync">
    <Content>
        @if (HostInterface is not null)
        {
            <MudGrid>
                <MudItem xs="12" sm="6" md="6" lg="3">
                    <KeyValueCard T="string" Key="Name" Value="@HostInterface?.Name" />
                </MudItem>
                <MudItem xs="12" sm="6" md="6" lg="3">
                    <KeyValueCard T="string" Key="Adapter" Value="@HostInterface?.Description" />
                </MudItem>
                <MudItem xs="12" sm="6" md="6" lg="3">
                    <KeyValueCard T="string" Key="Mac" Value="@HostInterface?.Mac" />
                </MudItem>
                <MudItem xs="12" sm="6" md="6" lg="3">
                    <KeyValueCard T="string" Key="Suffix" Value="@HostInterface?.Suffix" />
                </MudItem>
                <MudItem xs="12" sm="6" md="6" lg="3">
                    @{
                        var color = Enum.Parse<System.Net.NetworkInformation.OperationalStatus>(HostInterface?.Status, true) switch
                        {
                            System.Net.NetworkInformation.OperationalStatus.Up => Color.Success,
                            System.Net.NetworkInformation.OperationalStatus.Down => Color.Error,
                            _ => Color.Error
                        };

                        <KeyValueCard T="string" Key="Status" Value="@HostInterface?.Status" ValueColor="color" />
                    }
                </MudItem>
                <MudItem xs="12" sm="6" md="6" lg="3">
                    @{
                        var value = "-";

                        if (HostInterface?.Speed is not null)
                        {
                            value = Math.Round((HostInterface.Speed.Value / Math.Pow(1000, 3)), 2).ToString();
                        }

                        <KeyValueCard T="string" Key="Speed" Value="@($"{value} GBit/s")" />
                    }
                </MudItem>
                <MudItem xs="12" sm="6" md="6" lg="3">
                    @{
                        var value = "-";

                        if (HostInterface?.Sent is not null)
                        {
                            value = Math.Round((HostInterface.Sent.Value / Math.Pow(1000, 3)), 2).ToString();
                        }

                        <KeyValueCard T="string" Key="Sent" Value="@($"{value} GB")" />
                    }
                </MudItem>
                <MudItem xs="12" sm="6" md="6" lg="3">
                    @{
                        var value = "-";

                        if (HostInterface?.Received is not null)
                        {
                            value = Math.Round((HostInterface.Received.Value / Math.Pow(1000, 3)), 2).ToString();
                        }

                        <KeyValueCard T="string" Key="Received" Value="@($"{value} GB")" />
                    }
                </MudItem>
                <MudItem xs="12" sm="6" md="6" lg="3">
                    <KeyValueCard T="long?" Key="IPv4 MTU" Value="@HostInterface?.Ipv4Mtu" />
                </MudItem>
                <MudItem xs="12" sm="6" md="6" lg="3">
                    <KeyValueCard T="bool?" Key="IPv4 DHCP" Value="@HostInterface?.Ipv4Dhcp" />
                </MudItem>
                <MudItem xs="12" sm="6" md="6" lg="3">
                    <KeyValueCard T="bool?" Key="IPv4 Forwarding" Value="@HostInterface?.Ipv4Forwarding" />
                </MudItem>
                <MudItem xs="12" sm="6" md="6" lg="3">
                    <KeyValueCard T="long?" Key="IPv6 MTU" Value="@HostInterface?.Ipv6Mtu" />
                </MudItem>
                <MudItem xs="12" sm="6" md="6" lg="3">
                    <KeyValueCard T="long?" Key="Incoming Packets (Discarded)" Value="@HostInterface?.IncomingPacketsDiscarded" />
                </MudItem>
                <MudItem xs="12" sm="6" md="6" lg="3">
                    <KeyValueCard T="long?" Key="Incoming Packets (Errors)" Value="@HostInterface?.IncomingPacketsWithErrors" />
                </MudItem>
                <MudItem xs="12" sm="6" md="6" lg="3">
                    <KeyValueCard T="long?" Key="Incoming Packets (Unknown)" Value="@HostInterface?.IncomingUnknownProtocolPackets" />
                </MudItem>
                <MudItem xs="12" sm="6" md="6" lg="3">
                    <KeyValueCard T="long?" Key="Outgoing Packets (Discarded)" Value="@HostInterface?.OutgoingPacketsDiscarded" />
                </MudItem>
                    <MudItem xs="12" sm="6" md="6" lg="3">
                    <KeyValueCard T="long?" Key="Outgoing Packets (Discarded)" Value="@HostInterface?.OutgoingPacketsWithErrors" />
                    </MudItem>
            </MudGrid>
        }
    </Content>
</BaseContainer>