@inherits ComponentBase

<BaseContainer Title="@Title" Breadcrumbs="@Breadcrumbs" LoadData="LoadDataAsync">
    <Content>
        @if (HostVolume is not null)
        {
            <MudGrid>
                <MudItem xs="12" sm="6" md="6" lg="3">
                    <KeyValueCard T="string" Key="Label" Value="@HostVolume?.Label" />
                </MudItem>
                <MudItem xs="12" sm="6" md="6" lg="3">
                    <KeyValueCard T="string" Key="Name" Value="@HostVolume?.Name" />
                </MudItem>
                <MudItem xs="12" sm="6" md="6" lg="3">
                    <KeyValueCard T="string" Key="Serial" Value="@HostVolume?.Serial" />
                </MudItem>
                <MudItem xs="12" sm="6" md="6" lg="3">
                    <KeyValueCard T="string" Key="Type" Value="@HostVolume?.Type" />
                </MudItem>
                <MudItem xs="12" sm="6" md="6" lg="3">
                    @{
                        var capacity = "-";

                        if (HostVolume?.Size is not null)
                        {
                            capacity = $"{Math.Round((HostVolume.Size.Value / Math.Pow(1024, 3)), 2)} GB";
                        }

                        <KeyValueCard T="string" Key="Size" Value="@capacity" />
                    }
                </MudItem>
                <MudItem xs="12" sm="6" md="6" lg="3">
                    @{
                        double? size = null;
                        double? free = null;
                        var value = "-";

                        if (HostVolume?.FreeSpace is not null)
                        {
                            free = Math.Round((HostVolume.FreeSpace.Value / Math.Pow(1024, 3)), 2);
                            value = $"{free} GB";

                            if (HostVolume?.Size is not null && HostVolume?.Size is not null)
                            {
                                size = Math.Round((HostVolume.Size.Value / Math.Pow(1024, 3)), 2);
                                value += $" ({Math.Round(free.Value / size.Value * 100, 2)}%)";
                            }
                        }

                        <KeyValueCard T="string" Key="Free Space" Value="@value" />
                    }
                </MudItem>
                <MudItem xs="12" sm="6" md="6" lg="3">
                    <KeyValueCard T="bool?" Key="Compressed" Value="@HostVolume?.Compressed" />
                </MudItem>
                <MudItem xs="12" sm="6" md="6" lg="3">
                    <KeyValueCard T="bool?" Key="Bootable" Value="@HostVolume?.Bootable" />
                </MudItem>
                <MudItem xs="12" sm="6" md="6" lg="3">
                    <KeyValueCard T="bool?" Key="Primary" Value="@HostVolume?.Primary" />
                </MudItem>
                <MudItem xs="12" sm="6" md="6" lg="3">
                    <KeyValueCard T="bool?" Key="Boot" Value="@HostVolume?.Boot" />
                </MudItem>
                <MudItem xs="12" sm="6" md="6" lg="3">
                    <KeyValueCard T="ulong?" Key="Block Size" Value="@HostVolume?.BlockSize" />
                </MudItem>

                <MudItem xs="12" sm="6" md="6" lg="3">
                    <KeyValueCard T="ulong?" Key="Blocks" Value="@HostVolume?.Blocks" />
                </MudItem>
                <MudItem xs="12" sm="6" md="6" lg="3">
                    <KeyValueCard T="ulong?" Key="Block Offset" Value="@HostVolume?.StartingOffset" />
                </MudItem>
                @if (HostVolume?.Provider is not null)
                {
                    <MudItem xs="12" sm="6" md="6" lg="3">
                        <KeyValueCard T="string" Key="Provider" Value="@HostVolume?.Provider" />
                    </MudItem>
                }
            </MudGrid>
        }
    </Content>
</BaseContainer>