<?xml version="1.0" encoding="UTF-8"?>
<controls:ExtendedGrid xmlns="http://xamarin.com/schemas/2014/forms"
    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;assembly=BitwardenCore"
    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}" />
        <Label
            LineBreakMode="TailTruncation"
            Grid.Column="0"
            Grid.Row="1"
            Grid.ColumnSpan="6"
            StyleClass="list-subtitle, list-subtitle-platform"
            Text="{Binding Send.DisplayDate}" />
        <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}"
            AutomationProperties.IsInAccessibleTree="True"
            AutomationProperties.Name="{u:I18n Disabled}" />
        <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}"
            AutomationProperties.IsInAccessibleTree="True"
            AutomationProperties.Name="{u:I18n Password}" />
        <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}"
            AutomationProperties.IsInAccessibleTree="True"
            AutomationProperties.Name="{u:I18n MaxAccessCountReached}" />
        <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}"
            AutomationProperties.IsInAccessibleTree="True"
            AutomationProperties.Name="{u:I18n Expired}" />
        <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}"
            AutomationProperties.IsInAccessibleTree="True"
            AutomationProperties.Name="{u:I18n PendingDelete}" />
    </Grid>

    <controls:MiButton
        Grid.Row="0"
        Grid.Column="2"
        Text="&#xe5d3;"
        IsVisible="{Binding ShowOptions, Mode=OneWay}"
        StyleClass="list-row-button, list-row-button-platform, btn-disabled"
        Clicked="MoreButton_Clicked"
        VerticalOptions="CenterAndExpand"
        HorizontalOptions="EndAndExpand"
        AutomationProperties.IsInAccessibleTree="True"
        AutomationProperties.Name="{u:I18n Options}" />

</controls:ExtendedGrid>
