<?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="Stim.MainPage"
             Title="Accueil"
             Background="{StaticResource Secondary}">
    <Grid>
        <ScrollView>
            <Grid BackgroundColor="{StaticResource Tertiary}">
                <Grid.ColumnDefinitions>
                    <ColumnDefinition Width="*"/>
                    <ColumnDefinition Width="10*"/>
                    <ColumnDefinition Width="*"/>
                </Grid.ColumnDefinitions>

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

                <VerticalStackLayout BackgroundColor="{StaticResource Secondary}" Grid.Column="0"/>
                <VerticalStackLayout BackgroundColor="{StaticResource Secondary}" Grid.Column="2"/>
                <VerticalStackLayout BackgroundColor="{StaticResource Secondary}" Grid.Column="0" Grid.Row="1"/>
                <VerticalStackLayout BackgroundColor="{StaticResource Secondary}" Grid.Column="2" Grid.Row="1"/>

                <Grid Grid.Column="1">
                    <Grid.ColumnDefinitions>
                        <ColumnDefinition Width="*"/>
                        <ColumnDefinition Width="*"/>
                    </Grid.ColumnDefinitions>

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

                    <SearchBar x:Name="Game" TextChanged="SearchBar_GameChanged" Grid.ColumnSpan="2" Placeholder="Rechercher un jeu" Margin="5"/>
                    <SearchBar x:Name="Tag1" TextChanged="SearchBar_GameChanged" Grid.Column="0" Grid.Row="1" Placeholder="Tag 1" WidthRequest="200" HorizontalOptions="End" Margin="5"/>
                    <SearchBar x:Name="Tag2" TextChanged="SearchBar_GameChanged" Grid.Column="1" Grid.Row="1" Placeholder="Tag 2" WidthRequest="200" HorizontalOptions="Start" Margin="5"/>
                </Grid>

                <CollectionView ItemsSource="{Binding}" SelectionMode="Single" SelectionChanged="OnClickGameList" ItemsLayout="VerticalGrid, 5"  Grid.Column="1" Grid.Row="1" ItemTemplate="{StaticResource gameTemplate}"/>
            </Grid>
        </ScrollView>
        <ImageButton Source="add_white.png" Background="transparent" WidthRequest="50" HeightRequest="50" HorizontalOptions="End" VerticalOptions="End" Margin="0, 0, 10, 10" Clicked="GoToAddGamePage"/>
    </Grid>
</ContentPage>
