<?xml version="1.0" encoding="utf-8" ?>
<ContentPage xmlns="http://schemas.microsoft.com/dotnet/2021/maui"
             xmlns:x="http://schemas.microsoft.com/winfx/2009/xaml"
             x:Class="GMCabsDriverAssistantSolution.Views.HomePage"
             xmlns:vm="clr-namespace:GMCabsDriverAssistantSolution.ViewModels"
             x:DataType="vm:HomeViewModel"
             Title="{Binding Title}">
    <ContentPage.Resources>
        <ResourceDictionary>
            <Color x:Key="Accent">#96d1ff</Color>
        </ResourceDictionary>
    </ContentPage.Resources>
    <ContentPage.Content>
        <StackLayout Orientation="Vertical"
                     BackgroundColor="#DCDCDC">
            <Image Margin="48,40,48,0"
                   VerticalOptions="Center"
                   HorizontalOptions="Center"
                   Source="gmlogo.png"/>
            <Frame CornerRadius="10" 
                   BackgroundColor="#E8E8E8"
                   Margin="15"
                   Padding="15"
                   IsVisible="{Binding IsVisibleAcceptBookingView}">
                <StackLayout Orientation="Vertical">
                    <StackLayout Orientation="Horizontal">
                        <Image Source="ic_menu_rydo.png" WidthRequest="60" VerticalOptions="Start" />
                        <StackLayout Orientation="Vertical" HorizontalOptions="StartAndExpand" >
                            <Label Text="{Binding PickUpAddress, StringFormat='{0} to'}"
                                   FontSize="18"
                                   FontAttributes="Bold"
                                   TextColor="Black"
                                   HorizontalTextAlignment="Start"
                                   VerticalOptions="Start"
                                   VerticalTextAlignment="Start"/>
                            <Label Text="{Binding DropUpAddress}"
                                   FontSize="18"
                                   FontAttributes="Bold"
                                   TextColor="Black"
                                   HorizontalTextAlignment="Start"
                                   VerticalTextAlignment="Center"/>
                            <!--<Label FontAttributes="Bold"
                                   FontSize="20"
                                   HorizontalTextAlignment="Start"
                                   TextColor="Black">
                                <Label.Text>
                                    <MultiBinding StringFormat="{}{0} to {1}">
                                        <Binding Path="PickUpAddress" />
                                        <Binding Path="DropUpAddress" />
                                    </MultiBinding>
                                </Label.Text>
                            </Label>-->
                        </StackLayout>
                    </StackLayout>
                    <Label Text="Please confirm on terminal ASAP to keep this booking"
                                FontSize="20"
                                TextColor="Black"
                                HorizontalTextAlignment="Start"
                                VerticalTextAlignment="Center"/>
                    <StackLayout Orientation="Horizontal"  HorizontalOptions="StartAndExpand" >
                        <Label Text="Auto cancellation in"
                                   FontSize="20"
                                   TextColor="Black"
                                   HorizontalTextAlignment="Start"
                                   VerticalTextAlignment="Center"/>
                        <Label Text="{Binding TimerSeconds}"
                                   FontSize="25"
                                   FontAttributes="Bold"
                                   TextColor="Black"
                                   HorizontalTextAlignment="Start"
                                   VerticalTextAlignment="Center"/>
                    </StackLayout>
                </StackLayout>
            </Frame>
            <StackLayout VerticalOptions="EndAndExpand"  
                         Margin="8,20,8,16"
                         HorizontalOptions="CenterAndExpand">
                <StackLayout x:Name="SettingsRequired" Orientation="Horizontal" IsVisible="False">
                    <Image Source="setting_alert.png" 
                           WidthRequest="45" 
                           Margin="38,5,10,15"
                           VerticalOptions="Center"/>
                    <Label Text="Setting Change Required"
                               FontSize="20"
                               TextColor="Red"
                               HorizontalTextAlignment="Start"
                               VerticalTextAlignment="Center"
                               HorizontalOptions="StartAndExpand"/>
                    <StackLayout.GestureRecognizers>
                        <TapGestureRecognizer Tapped="SettingsRequired_Tapped"/>
                    </StackLayout.GestureRecognizers>
                </StackLayout>


                <Frame CornerRadius="10" 
                       Padding="8"
                       IsVisible="{Binding IsBookingAvailable}"
                       BackgroundColor="White">
                    <StackLayout Orientation="Horizontal">
                        <Image Source="ic_menu_rydo.png" 
                               WidthRequest="45" 
                               Margin="5,5,0,5"
                               VerticalOptions="Center"/>
                        <Label Text="Bookings Available"
                               FontSize="20"
                               TextColor="Black"
                               HorizontalTextAlignment="Start"
                               VerticalTextAlignment="Center"
                               HorizontalOptions="StartAndExpand"/>
                        <Button Text="View"                                 
                                FontSize="20"
                                HorizontalOptions="End" 
                                VerticalOptions="Center"
                                Clicked="OnBookingViewClicked"/>
                    </StackLayout>
                </Frame>
                <Frame CornerRadius="10" 
                       Padding="8"
                       IsVisible="{Binding HasUnreadNotifications}"
                       BackgroundColor="White">
                    <StackLayout Orientation="Horizontal">
                        <AbsoluteLayout VerticalOptions="Center" HorizontalOptions="Center">
                            <Image Source="message.png" 
                                   WidthRequest="50" />
                            <Image Source="importanticonsmall.png" 
                                   HeightRequest="20" 
                                   Margin="30,0,0,0"/>
                        </AbsoluteLayout>

                        <Label Text="Unread Messages"
                               FontSize="20"
                               TextColor="Black"
                               HorizontalTextAlignment="Start"
                               VerticalTextAlignment="Center"
                               HorizontalOptions="StartAndExpand"/>
                        <Button Text="View"
                                FontSize="20"
                                HorizontalOptions="End" 
                                VerticalOptions="Center"
                                Clicked="OnNotificationViewClicked"/>
                    </StackLayout>
                </Frame>
            </StackLayout>
        </StackLayout>
    </ContentPage.Content>
</ContentPage>