<?xml version="1.0" encoding="utf-8"?>
<androidx.coordinatorlayout.widget.CoordinatorLayout
    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:layout_width="match_parent"
    android:layout_height="match_parent"
    android:background="?attr/colorSurface">

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

        <com.google.android.material.appbar.MaterialToolbar
            android:id="@+id/toolbar_new_user"
            android:layout_width="match_parent"
            android:layout_height="?attr/actionBarSize"
            app:title="@string/profile_new_user"
            app:navigationIcon="@drawable/ic_back"
            app:titleCentered="false" />

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

    <androidx.core.widget.NestedScrollView
        android:id="@+id/scroll_content"
        android:layout_width="match_parent"
        android:layout_height="match_parent"
        android:clipToPadding="false"
        android:paddingBottom="88dp"
        app:layout_behavior="@string/appbar_scrolling_view_behavior">

        <LinearLayout
            android:layout_width="match_parent"
            android:layout_height="wrap_content"
            android:orientation="vertical"
            android:paddingHorizontal="24dp"
            android:paddingVertical="16dp">

            <com.google.android.material.card.MaterialCardView
                android:layout_width="128dp"
                android:layout_height="128dp"
                android:layout_gravity="center_horizontal"
                android:layout_marginBottom="24dp"
                style="@style/Widget.Material3.CardView.Elevated"
                app:cardCornerRadius="64dp"
                app:cardElevation="4dp">

                <ImageView
                    android:id="@+id/image_user_avatar"
                    android:layout_width="match_parent"
                    android:layout_height="match_parent"
                    android:scaleType="centerCrop"
                    android:contentDescription="@string/profile_avatar"
                    tools:src="@drawable/ic_account_circle" />

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

            <LinearLayout
                android:layout_width="match_parent"
                android:layout_height="wrap_content"
                android:orientation="vertical"
                android:gravity="center"
                android:layout_marginBottom="24dp">

                <LinearLayout
                    android:layout_width="match_parent"
                    android:layout_height="wrap_content"
                    android:orientation="horizontal"
                    android:gravity="center">

                    <com.google.android.material.button.MaterialButton
                        android:id="@+id/button_select_image"
                        android:layout_width="0dp"
                        android:layout_height="wrap_content"
                        android:layout_weight="1"
                        android:text="@string/profile_select_image"
                        style="@style/Widget.Material3.Button.TonalButton"
                        app:icon="@drawable/ic_add"
                        android:layout_marginEnd="4dp" />

                    <com.google.android.material.button.MaterialButton
                        android:id="@+id/button_firmware_avatars"
                        android:layout_width="0dp"
                        android:layout_height="wrap_content"
                        android:layout_weight="1"
                        android:text="@string/profile_firmware_avatars"
                        style="@style/Widget.Material3.Button.TonalButton"
                        app:icon="@drawable/ic_account_circle"
                        android:layout_marginStart="4dp"
                        android:visibility="gone" />

                </LinearLayout>

                <com.google.android.material.button.MaterialButton
                    android:id="@+id/button_revert_image"
                    android:layout_width="wrap_content"
                    android:layout_height="wrap_content"
                    android:layout_marginTop="8dp"
                    android:text="@string/profile_revert_image"
                    style="@style/Widget.Material3.Button.TextButton"
                    android:visibility="gone" />

            </LinearLayout>

            <com.google.android.material.textfield.TextInputLayout
                android:layout_width="match_parent"
                android:layout_height="wrap_content"
                android:layout_marginBottom="24dp"
                android:hint="@string/profile_username">

                <com.google.android.material.textfield.TextInputEditText
                    android:id="@+id/edit_username"
                    android:layout_width="match_parent"
                    android:layout_height="wrap_content"
                    android:inputType="text"
                    android:maxLength="32"
                    android:maxLines="1"
                    android:minHeight="48dp" />

            </com.google.android.material.textfield.TextInputLayout>

            <com.google.android.material.card.MaterialCardView
                android:layout_width="match_parent"
                android:layout_height="wrap_content"
                android:layout_marginBottom="16dp"
                style="@style/Widget.Material3.CardView.Filled"
                app:cardCornerRadius="16dp">

                <LinearLayout
                    android:layout_width="match_parent"
                    android:layout_height="wrap_content"
                    android:orientation="vertical"
                    android:padding="16dp">

                    <TextView
                        android:layout_width="match_parent"
                        android:layout_height="wrap_content"
                        android:text="@string/profile_uuid"
                        android:textAppearance="?attr/textAppearanceLabelMedium"
                        android:textColor="?attr/colorOnSurfaceVariant"
                        android:layout_marginBottom="8dp" />

                    <LinearLayout
                        android:layout_width="match_parent"
                        android:layout_height="wrap_content"
                        android:orientation="horizontal"
                        android:gravity="center_vertical">

                        <TextView
                            android:id="@+id/text_uuid"
                            android:layout_width="0dp"
                            android:layout_height="wrap_content"
                            android:layout_weight="1"
                            android:textAppearance="?attr/textAppearanceBodyMedium"
                            android:fontFamily="monospace"
                            android:textIsSelectable="true"
                            tools:text="12345678-1234-1234-1234-123456789012" />

                        <com.google.android.material.button.MaterialButton
                            android:id="@+id/button_generate_uuid"
                            android:layout_width="wrap_content"
                            android:layout_height="wrap_content"
                            android:text="@string/profile_generate"
                            style="@style/Widget.Material3.Button.TextButton"
                            app:icon="@drawable/ic_refresh"
                            app:iconGravity="textStart" />

                    </LinearLayout>

                    <TextView
                        android:layout_width="match_parent"
                        android:layout_height="wrap_content"
                        android:text="@string/profile_uuid_description"
                        android:textAppearance="?attr/textAppearanceBodySmall"
                        android:textColor="?attr/colorOnSurfaceVariant"
                        android:layout_marginTop="8dp" />

                </LinearLayout>

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

        </LinearLayout>

    </androidx.core.widget.NestedScrollView>

    <com.google.android.material.card.MaterialCardView
        android:id="@+id/button_layout"
        android:layout_width="match_parent"
        android:layout_height="wrap_content"
        android:layout_gravity="bottom"
        style="@style/Widget.Material3.CardView.Elevated"
        app:cardCornerRadius="0dp"
        app:cardElevation="8dp">

        <LinearLayout
            android:layout_width="match_parent"
            android:id="@+id/button_container"
            android:layout_height="wrap_content"
            android:orientation="horizontal"
            android:padding="16dp"
            android:paddingBottom="24dp">

            <com.google.android.material.button.MaterialButton
                android:id="@+id/button_cancel"
                android:layout_width="0dp"
                android:layout_height="wrap_content"
                android:layout_weight="1"
                android:layout_marginEnd="8dp"
                android:text="@android:string/cancel"
                style="@style/Widget.Material3.Button.TonalButton" />

            <com.google.android.material.button.MaterialButton
                android:id="@+id/button_save"
                android:layout_width="0dp"
                android:layout_height="wrap_content"
                android:layout_weight="1"
                android:layout_marginStart="8dp"
                android:text="@string/save"
                style="@style/Widget.Material3.Button" />

        </LinearLayout>

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

</androidx.coordinatorlayout.widget.CoordinatorLayout>
