<?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"
             xmlns:local="clr-namespace:Stim"
             x:Class="Stim.DetailledPage"
             Title="{Binding Name, FallbackValue='Default'}"
             Background="{StaticResource Secondary}">

        <Grid>
        <Grid.RowDefinitions>
            <RowDefinition Height="*" />
        </Grid.RowDefinitions>
        <ScrollView>
            <Grid ColumnDefinitions="*, 10*, *">
                <VerticalStackLayout Style="{StaticResource pageBorder}" Grid.Column="0"/>
                <VerticalStackLayout Style="{StaticResource pageBorder}" Grid.Column="2"/>

                <Grid Background="{StaticResource Tertiary}" Grid.Column="1" ColumnDefinitions="*, *, *, *" RowDefinitions="auto, *, auto, auto, auto">
                    <Image Grid.RowSpan="4" Margin="5, 0, 0, 0" Source="{Binding Cover, FallbackValue='no_cover.png'}" Aspect="AspectFit"/>
                    <Label Grid.Column="1" Text="{Binding Name, FallbackValue='Default'}" FontSize="30"/>
                    <Label Grid.Column="2" Text="{Binding Year, FallbackValue='2023'}" HorizontalOptions="Center"/>
                    <ImageButton Grid.Column="3" Style="{StaticResource removeButton}" Clicked="RemoveGame" HorizontalOptions="Start"/>
                    <Button Grid.Column="4" Style="{StaticResource followButton}" Clicked="AddFollow"/>

                    <ScrollView Grid.Column="1" Grid.ColumnSpan="4" Grid.Row="1">
                        <Label Text="{Binding Description, FallbackValue='Default'}"/>
                    </ScrollView>

                    <Grid Grid.Column="1" Grid.ColumnSpan="4" Grid.Row="2" RowDefinitions="auto, auto">
                        <Label Text="Tags :"/>
                        <CollectionView Grid.Row="1" ItemsSource="{Binding Tags}" ItemTemplate="{StaticResource tagsTemplate}"/>
                    </Grid>

                    <Label Grid.Column="1" Grid.Row="3" Text="{Binding Lien, FallbackValue='Default'}"/>

                    <local:StarsContainer Rate="{Binding Average, FallbackValue='0'}" Grid.Column="4" Grid.Row="3"/>
                    
                    <VerticalStackLayout Grid.ColumnSpan="4" Grid.Row="4">
                        <Label Text="Avis de la communauté :" FontSize="30"/>
                        <CollectionView ItemsSource="{Binding Reviews}" ItemTemplate="{StaticResource reviewTemplate}"/>
                    </VerticalStackLayout>
                </Grid>
            </Grid>
        </ScrollView>
        <ImageButton Style="{StaticResource addButton}" Clicked="AddReview"/>
    </Grid>
</ContentPage>
