@inherits ComponentBase

<TableContainer T="ViewModel"
                @ref="Container"
                @bind-Search="Search"
                Title="@Title"
                Breadcrumbs="@Breadcrumbs"
                Data="LoadDataAsync">
    <Header>
        <MudTh>
            <MudTableSortLabel SortLabel="Customer" T="ViewModel">
                Customer
            </MudTableSortLabel>
        </MudTh>
        <MudTh>
            <MudTableSortLabel SortLabel="Host" T="ViewModel">
                Host
            </MudTableSortLabel>
        </MudTh>
        <MudTh>
            <MudTableSortLabel SortLabel="User" T="ViewModel">
                User
            </MudTableSortLabel>
        </MudTh>
        <MudTh>
            <MudTableSortLabel SortLabel="Remote" T="ViewModel">
                Remote
            </MudTableSortLabel>
        </MudTh>
        <MudTh>
            <MudTableSortLabel SortLabel="State" T="ViewModel">
                State
            </MudTableSortLabel>
        </MudTh>
    </Header>
    <RowTemplate>
        <MudTd DataLabel="Customer">
            <MudLink Href="@Navigation.Management.Customers.DetailsHref(@context?.Customers?.Id)" Typo="Typo.inherit" Underline="Underline.None">
                @context?.Customers?.Name
            </MudLink>
        </MudTd>
        <MudTd DataLabel="Host">
            <MudLink Href="@Navigation.Management.Hosts.DetailsHref(@context?.Hosts?.Id)" Typo="Typo.inherit" Underline="Underline.None">
                @context?.Hosts?.Name
            </MudLink>
        </MudTd>
        <MudTd DataLabel="User">
            @context?.User
        </MudTd>
        <MudTd DataLabel="Remote">
            @{
                var value = string.Empty;

                if (context?.Remote?.StartsWith("0") is false)
                {
                    value = context?.Remote;
                }

                @value;
            }
        </MudTd>
        <MudTd DataLabel="State">
            @{
                var value = context?.State?.ToLower() switch
                {
                    "wtsactive" => "Active",
                    "wtsdisconnected" => "Inactive",
                    _ => ""
                };

                var color = value?.ToLower() switch
                {
                    "active" => Color.Success,
                    "inactive" => Color.Inherit,
                    _ => Color.Error
                };
                <MudText Color="color" Typo="Typo.inherit">
                    @value
                </MudText>
            }
        </MudTd>
    </RowTemplate>
</TableContainer>