<?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="Linaris.PlaylistPage"
             xmlns:local="clr-namespace:Linaris"
             Title="Playlist"
             Style="{StaticResource PageFlyoutTrigger}">

    <Grid Style="{StaticResource GridFlyoutTrigger}">
        <Grid.RowDefinitions>
            <RowDefinition Height="8*"/>
            <RowDefinition Height="*"/>
        </Grid.RowDefinitions>

        <local:Layout Grid.Column="0"/>

        <ScrollView Grid.Column="1"
                             BackgroundColor="#404040">
            <VerticalStackLayout>
                <SearchBar Style="{StaticResource SearchBar}"/>
                <Frame IsClippedToBounds="True" CornerRadius="75" HeightRequest="150" WidthRequest="150" HorizontalOptions="Center" VerticalOptions="Center" BackgroundColor="Transparent">
                    <Image Source="{Binding ImageURL}" Aspect="AspectFill" WidthRequest="150" HeightRequest="150" Margin="-20" IsAnimationPlaying="True"/>
                </Frame>
                <Label Text="{Binding Name}" Style="{StaticResource Titre}"/>
                <Label Text="{Binding Description}" Style="{StaticResource SousTitre}"/>
                <Grid BackgroundColor="Transparent" MinimumHeightRequest="0" Margin="0,20,0,0">
                    <FlexLayout Direction="Row" AlignItems="Center" JustifyContent="SpaceEvenly" Wrap="Wrap">
                        <Button Text="Aléatoire" Style="{StaticResource PlayButton}"/>
                        <Button Text="Lecture" Style="{StaticResource PlayButton}"/>
                        <Button Text="Modifier" Style="{StaticResource PlayButton}" Clicked="EditPlaylist"/>
                    </FlexLayout>
                </Grid>

                <ListView ItemsSource="{Binding Titles}">
                    <ListView.ItemTemplate>
                        <DataTemplate>
                            <ViewCell>
                                <Frame Style="{StaticResource Song}">
                                    <Label Text="{Binding Name}" FontSize="20" TextColor="white" HorizontalTextAlignment="Center"/>
                                </Frame>
                            </ViewCell>
                        </DataTemplate>
                    </ListView.ItemTemplate>
                </ListView>
            </VerticalStackLayout>
        </ScrollView>
        <local:FooterPage Grid.Row="1" Grid.ColumnSpan="2"/>
    </Grid>
</ContentPage>