<?xml version="1.0" encoding="utf-8"?>
<androidx.drawerlayout.widget.DrawerLayout
    xmlns:android="http://schemas.android.com/apk/res/android"
    xmlns:app="http://schemas.android.com/apk/res-auto"
    xmlns:tools="http://schemas.android.com/tools"
    android:id="@+id/drawerLayout"
    android:layout_width="match_parent"
    android:layout_height="match_parent"
    android:fitsSystemWindows="true"
    tools:context=".ui.MainActivity">

    <RelativeLayout
        android:layout_width="match_parent"
        android:layout_height="match_parent">

        <com.google.android.material.appbar.AppBarLayout
            android:id="@+id/appBarLayout"
            android:layout_width="match_parent"
            android:layout_height="wrap_content"
            android:layout_alignParentTop="true">

            <LinearLayout
                android:layout_width="match_parent"
                android:layout_height="?attr/actionBarSize"
                android:orientation="horizontal"
                android:gravity="center_vertical"
                android:paddingStart="4dp"
                android:paddingEnd="16dp">

                <ImageButton
                    android:id="@+id/hamburgerButton"
                    android:layout_width="48dp"
                    android:layout_height="48dp"
                    android:background="?attr/selectableItemBackgroundBorderless"
                    android:src="@drawable/ic_menu_hamburger"
                    android:contentDescription="@string/settings"
                    android:clickable="true"
                    android:focusable="true" />

                <ImageView
                    android:id="@+id/logoButton"
                    android:layout_width="36dp"
                    android:layout_height="36dp"
                    android:src="@drawable/ic_mistral_logo"
                    android:contentDescription="@string/select_model"
                    android:clickable="true"
                    android:focusable="true" />

                <TextView
                    android:id="@+id/toolbarTitle"
                    android:layout_width="0dp"
                    android:layout_height="wrap_content"
                    android:layout_weight="1"
                    android:layout_marginStart="12dp"
                    android:text="Le Chat"
                    android:textSize="20sp"
                    android:textStyle="bold"
                    android:textColor="?attr/colorOnSurface" />

                <ImageButton
                    android:id="@+id/menuButton"
                    android:layout_width="36dp"
                    android:layout_height="36dp"
                    android:background="?attr/selectableItemBackgroundBorderless"
                    android:src="@drawable/ic_menu_dots"
                    android:contentDescription="@string/settings"
                    android:clickable="true"
                    android:focusable="true" />

            </LinearLayout>

        </com.google.android.material.appbar.AppBarLayout>

        <androidx.recyclerview.widget.RecyclerView
            android:id="@+id/recyclerView"
            android:layout_width="match_parent"
            android:layout_height="match_parent"
            android:layout_above="@+id/inputContainer"
            android:layout_below="@+id/appBarLayout"
            android:padding="16dp"
            android:clipToPadding="false" />

        <LinearLayout
            android:id="@+id/inputContainer"
            android:layout_width="match_parent"
            android:layout_height="wrap_content"
            android:layout_alignParentBottom="true"
            android:orientation="vertical"
            android:background="?attr/colorSurface"
            android:padding="16dp">

            <com.google.android.material.progressindicator.LinearProgressIndicator
                android:id="@+id/progressIndicator"
                android:layout_width="match_parent"
                android:layout_height="wrap_content"
                android:indeterminate="true"
                android:visibility="gone"
                android:layout_marginBottom="8dp" />

            <com.google.android.material.card.MaterialCardView
                android:id="@+id/inputCard"
                android:layout_width="match_parent"
                android:layout_height="wrap_content"
                app:cardCornerRadius="16dp"
                app:cardElevation="2dp">

                <LinearLayout
                    android:layout_width="match_parent"
                    android:layout_height="wrap_content"
                    android:gravity="center_vertical"
                    android:orientation="horizontal"
                    android:paddingStart="4dp"
                    android:paddingEnd="0dp"
                    android:paddingTop="4dp"
                    android:paddingBottom="4dp">

                    <com.google.android.material.textfield.TextInputEditText
                        android:id="@+id/inputField"
                        android:layout_width="0dp"
                        android:layout_height="wrap_content"
                        android:layout_weight="1"
                        android:background="@android:color/transparent"
                        android:hint="@string/enter_message"
                        android:imeOptions="actionSend"
                        android:inputType="textMultiLine|textCapSentences"
                        android:maxLines="5"
                        android:minHeight="56dp"
                        android:paddingStart="8dp"
                        android:paddingEnd="8dp"
                        android:paddingTop="12dp"
                        android:paddingBottom="12dp" />

                    <ImageView
                        android:id="@+id/sendButton"
                        android:layout_width="40dp"
                        android:layout_height="40dp"
                        android:padding="8dp"
                        android:src="@drawable/ic_mistral_logo"
                        android:background="@drawable/bg_send_button"
                        android:contentDescription="@string/send"
                        android:clickable="true"
                        android:focusable="true" />

                </LinearLayout>

            </com.google.android.material.card.MaterialCardView>

        </LinearLayout>

    </RelativeLayout>

    <com.google.android.material.navigation.NavigationView
        android:id="@+id/navigationView"
        android:layout_width="wrap_content"
        android:layout_height="match_parent"
        android:layout_gravity="start"
        android:fitsSystemWindows="true"
        app:headerLayout="@layout/nav_header"
        app:menu="@menu/drawer_menu" />

    <FrameLayout
        android:id="@+id/rightPanelContainer"
        android:layout_width="300dp"
        android:layout_height="match_parent"
        android:layout_gravity="end"
        android:background="?attr/colorSurface">

        <include layout="@layout/panel_right" />

    </FrameLayout>

</androidx.drawerlayout.widget.DrawerLayout>