<?xml version="1.0" encoding="UTF-8"?>
<controls:ExtendedGrid xmlns="http://schemas.microsoft.com/dotnet/2021/maui"
    xmlns:x="http://schemas.microsoft.com/winfx/2009/xaml"
    x:Class="Bit.App.Controls.SendViewCell"
    xmlns:controls="clr-namespace:Bit.App.Controls"
    xmlns:u="clr-namespace:Bit.App.Utilities"
    xmlns:core="clr-namespace:Bit.Core"
    StyleClass="list-row, list-row-platform"
    RowSpacing="0"
    ColumnSpacing="0"
    x:DataType="controls:SendViewCellViewModel">

    <Grid.Resources>
          <u:SendIconGlyphConverter x:Key="sendIconGlyphConverter"/>
    </Grid.Resources>

    <Grid.RowDefinitions>
        <RowDefinition Height="Auto" />
    </Grid.RowDefinitions>

    <Grid.ColumnDefinitions>
        <ColumnDefinition Width="40" x:Name="_iconColumn" />
        <ColumnDefinition Width="*" />
        <ColumnDefinition Width="60" />
    </Grid.ColumnDefinitions>

    <controls:IconLabel
        Grid.Row="0"
        Grid.Column="0"
        HorizontalOptions="Center"
        VerticalOptions="Center"
        StyleClass="list-icon, list-icon-platform"
        Text="{Binding Send, Converter={StaticResource sendIconGlyphConverter}}"
        ShouldUpdateFontSizeDynamicallyForAccesibility="True"
        AutomationProperties.IsInAccessibleTree="False" />

    <Grid RowSpacing="0" ColumnSpacing="0" Grid.Row="0" Grid.Column="1" VerticalOptions="Center" Padding="0, 7">
        <Grid.RowDefinitions>
            <RowDefinition Height="Auto" />
            <RowDefinition Height="Auto" />
        </Grid.RowDefinitions>

        <Grid.ColumnDefinitions>
            <ColumnDefinition Width="Auto" />
            <ColumnDefinition Width="Auto" />
            <ColumnDefinition Width="Auto" />
            <ColumnDefinition Width="Auto" />
            <ColumnDefinition Width="Auto" />
            <ColumnDefinition Width="*" />
        </Grid.ColumnDefinitions>

        <Label
            LineBreakMode="TailTruncation"
            Grid.Column="0"
            Grid.Row="0"
            StyleClass="list-title, list-title-platform"
            Text="{Binding Send.Name}"
            AutomationId="SendNameLabel" />
        <Label
            LineBreakMode="TailTruncation"
            Grid.Column="0"
            Grid.Row="1"
            Grid.ColumnSpan="6"
            StyleClass="list-subtitle, list-subtitle-platform"
            Text="{Binding Send.DisplayDate}"
            AutomationId="SendDateLabel" />
        <controls:IconLabel
            Grid.Column="1"
            Grid.Row="0"
            HorizontalOptions="Start"
            VerticalOptions="Center"
            StyleClass="list-title-icon"
            Margin="5, 0, 0, 0"
            Text="{Binding Source={x:Static core:BitwardenIcons.ExclamationTriangle}}"
            IsVisible="{Binding Send.Disabled, Mode=OneTime}"
            SemanticProperties.Description="{u:I18n Disabled}"
            AutomationId="DisabledSendLabel" />
        <controls:IconLabel
            Grid.Column="2"
            Grid.Row="0"
            HorizontalOptions="Start"
            VerticalOptions="Center"
            StyleClass="list-title-icon"
            Margin="5, 0, 0, 0"
            Text="{Binding Source={x:Static core:BitwardenIcons.Key}}"
            IsVisible="{Binding Send.HasPassword, Mode=OneTime}"
            SemanticProperties.Description="{u:I18n Password}"
            AutomationId="PasswordProtectedSendLabel" />
        <controls:IconLabel
            Grid.Column="3"
            Grid.Row="0"
            HorizontalOptions="Start"
            VerticalOptions="Center"
            StyleClass="list-title-icon"
            Margin="5, 0, 0, 0"
            Text="{Binding Source={x:Static core:BitwardenIcons.Ban}}"
            IsVisible="{Binding Send.MaxAccessCountReached, Mode=OneTime}"
            SemanticProperties.Description="{u:I18n MaxAccessCountReached}"
            AutomationId="SendMaxAccessCountReachedLabel" />
        <controls:IconLabel
            Grid.Column="4"
            Grid.Row="0"
            HorizontalOptions="Start"
            VerticalOptions="Center"
            StyleClass="list-title-icon"
            Margin="5, 0, 0, 0"
            Text="{Binding Source={x:Static core:BitwardenIcons.Clock}}"
            IsVisible="{Binding Send.Expired, Mode=OneTime}"
            SemanticProperties.Description="{u:I18n Expired}"
            AutomationId="ExpiredSendLabel" />
        <controls:IconLabel
            Grid.Column="5"
            Grid.Row="0"
            HorizontalOptions="Start"
            VerticalOptions="Center"
            StyleClass="list-title-icon"
            Margin="5, 0, 0, 0"
            Text="{Binding Source={x:Static core:BitwardenIcons.Trash}}"
            IsVisible="{Binding Send.PendingDelete, Mode=OneTime}"
            SemanticProperties.Description="{u:I18n PendingDelete}"
            AutomationId="SendWithPendingDeletionLabel" />
    </Grid>

    <controls:MiButton
        Grid.Row="0"
        Grid.Column="2"
        Text="{Binding Source={x:Static core:BitwardenIcons.ViewCellMenu}}"
        IsVisible="{Binding ShowOptions, Mode=OneWay}"
        StyleClass="list-row-button, list-row-button-platform, btn-disabled"
        Clicked="MoreButton_Clicked"
        VerticalOptions="CenterAndExpand"
        HorizontalOptions="EndAndExpand"
        SemanticProperties.Description="{u:I18n Options}"
        AutomationId="SendOptionsButton" />

</controls:ExtendedGrid>
