<?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:HeaderView="clr-namespace:Stim"
             x:Class="Stim.DetailledPage"
             Title="Accueil"
             Background="black">
    
    <ScrollView>
        <Grid BackgroundColor="#495057">
            <Grid.ColumnDefinitions>
                <ColumnDefinition Width="*"/>
                <ColumnDefinition Width="5*"/>
                <ColumnDefinition Width="*"/>
            </Grid.ColumnDefinitions>

            <Grid.RowDefinitions>
                <RowDefinition Height="auto"/>
                <RowDefinition Height="*"/>
            </Grid.RowDefinitions>

            <VerticalStackLayout BackgroundColor="Black" Grid.Column="0"/>
            <VerticalStackLayout BackgroundColor="Black" Grid.Column="2"/>
            <VerticalStackLayout BackgroundColor="Black" Grid.Column="0" Grid.Row="1"/>
            <VerticalStackLayout BackgroundColor="Black" Grid.Column="2" Grid.Row="1"/>

            <Grid HeightRequest="1000" Grid.Column="1" Grid.Row="1" Margin="0">
                <Grid.ColumnDefinitions>
                    <ColumnDefinition Width="*"/>
                    <ColumnDefinition Width="2*"/>
                </Grid.ColumnDefinitions>
                <Grid.RowDefinitions>
                    <RowDefinition Height="2*"/>
                    <RowDefinition Height="auto"/>
                </Grid.RowDefinitions>
                
                <Image Margin="0, 10, 0, 0" Source="{Binding Cover}"/>

                <Grid Grid.Column="2" Padding="5">
                    <Grid.ColumnDefinitions>
                        <ColumnDefinition Width="4*"/>
                        <ColumnDefinition Width="*"/>
                        <ColumnDefinition Width="2*"/>
                    </Grid.ColumnDefinitions>
                    <Grid.RowDefinitions>
                        <RowDefinition Height="*"/>
                        <RowDefinition Height="2*"/>
                        <RowDefinition Height="*"/>
                        <RowDefinition Height="*"/>
                    </Grid.RowDefinitions>

                    <Label Text="{Binding Name}" TextColor="White" VerticalTextAlignment="Center" FontSize="30"/>
                    <Label Grid.Column="1" TextColor="White" VerticalTextAlignment="Center" Text="{Binding Year}"/>
                    <Button Grid.Column="3" TextColor="White" Text="suivre" HorizontalOptions="End"
                            VerticalOptions="Center" Background="transparent" CornerRadius="0" BorderWidth="3" BorderColor="Black"/>
                    <Label Grid.Row="1" Grid.ColumnSpan="4" TextColor="White" Text="{Binding Description}"/>
                    <VerticalStackLayout Grid.Row="2" VerticalOptions="End">
                        <Label Text="Tags :" TextColor="White"/>
                        <Label Text="   - Tag 1" TextColor="White"/>
                        <Label Text="   - Tag 2" TextColor="White"/>
                        <Label Text="   - Tag 3" TextColor="White"/>
                    </VerticalStackLayout>

                    <Label Grid.Row="3" Grid.ColumnSpan="4" VerticalOptions="End" TextDecorations="Underline" TextColor="White" Text="https://idhaklzhdkhazkdhaz.fr&#10;https://ioghzilghieriugo.fr"/>
                    <HorizontalStackLayout Grid.Row="3" Grid.Column="2" VerticalOptions="End" HorizontalOptions="End">
                        <Image Source="etoile_pleine.png" WidthRequest="25"/>
                        <Image Source="etoile_pleine.png" WidthRequest="25"/>
                        <Image Source="etoile_pleine.png" WidthRequest="25"/>
                        <Image Source="etoile_mi_pleine.png" WidthRequest="25"/>
                        <Image Source="etoile_vide.png" WidthRequest="25"/>
                        <Label Padding="5" HorizontalTextAlignment="End" FontAttributes="Bold" FontSize="20" TextColor="White" Text="3.5/5"/>
                    </HorizontalStackLayout>
                </Grid>

                <VerticalStackLayout Padding="10" Grid.Row="1" Grid.ColumnSpan="2">
                    <Label Grid.Row="1" Grid.RowSpan="2" Text="Avis de la communauté :" TextColor="White" FontSize="25"/>
                    <CollectionView ItemsSource="{Binding Reviews}">
                        <CollectionView.ItemTemplate>
                            <DataTemplate>
                                <VerticalStackLayout Margin="20,20,0,0">
                                    <HorizontalStackLayout Grid.Column="1" Padding="0,0,0,5" VerticalOptions="Start" HorizontalOptions="Start">
                                        <Label Margin="0, 0, 5, 0" FontSize="20" TextColor="White" Text="{Binding AuthorName}"/>
                                        <Image Source="etoile_pleine.png" WidthRequest="25"/>
                                        <Image Source="etoile_pleine.png" WidthRequest="25"/>
                                        <Image Source="etoile_vide.png" WidthRequest="25"/>
                                        <Image Source="etoile_vide.png" WidthRequest="25"/>
                                        <Image Source="etoile_vide.png" WidthRequest="25"/>
                                    </HorizontalStackLayout>
                                    <Label TextColor="White" Text="{Binding Text}"/>
                                </VerticalStackLayout>
                            </DataTemplate>
                        </CollectionView.ItemTemplate>
                    </CollectionView>
                </VerticalStackLayout>
            </Grid>
            
        </Grid>
    </ScrollView>
</ContentPage>
