<?xml version="1.0" encoding="utf-8"?>
<com.google.android.material.card.MaterialCardView 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"
    style="?attr/materialCardViewElevatedStyle"
    android:id="@+id/row"
    android:layout_width="match_parent"
    android:layout_height="wrap_content"
    android:layout_margin="5dp">

    <androidx.constraintlayout.widget.ConstraintLayout
        android:layout_width="match_parent"
        android:layout_height="wrap_content">

        <com.google.android.material.card.MaterialCardView
            android:id="@+id/icon_layout"
            android:layout_width="match_parent"
            android:layout_height="0dp"
            android:outlineProvider="none"
            app:cardCornerRadius="8dp"
            app:strokeWidth="0dp"
            app:layout_constraintBottom_toTopOf="@+id/store"
            app:layout_constraintDimensionRatio="85.6f:53.98f"
            app:layout_constraintTop_toTopOf="parent">

            <ImageView
                android:id="@+id/thumbnail"
                android:layout_width="match_parent"
                android:layout_height="match_parent"
                android:contentDescription="@string/thumbnailDescription"
                android:scaleType="fitCenter"
                android:src="@mipmap/ic_launcher"
                app:layout_constraintBottom_toBottomOf="parent"
                app:layout_constraintEnd_toEndOf="parent"
                app:layout_constraintStart_toStartOf="parent"
                app:layout_constraintTop_toTopOf="parent" />

            <TextView
                android:id="@+id/thumbnail_text"
                android:importantForAccessibility="no"
                android:layout_width="match_parent"
                android:layout_height="match_parent"
                android:textStyle="bold"
                app:autoSizeMinTextSize="6sp"
                app:autoSizeTextType="uniform"
                android:gravity="center"
                android:padding="10dp" />

            <ImageView
                android:importantForAccessibility="no"
                android:id="@+id/selected_thumbnail"
                android:layout_width="match_parent"
                android:layout_height="match_parent"
                android:contentDescription="@string/thumbnailDescription"
                android:scaleType="fitCenter"
                app:layout_constraintBottom_toBottomOf="parent"
                app:layout_constraintEnd_toEndOf="parent"
                app:layout_constraintStart_toStartOf="parent"
                app:layout_constraintTop_toTopOf="parent"
                app:srcCompat="@drawable/ic_done"
                android:background="@color/md_theme_dark_onSelected" />

            <androidx.constraintlayout.widget.ConstraintLayout
                android:id="@+id/star"
                android:layout_width="wrap_content"
                android:layout_height="wrap_content"
                android:layout_gravity="end"
                tools:ignore="ExtraText">

                <ImageView
                    android:id="@+id/star_background"
                    android:layout_width="@dimen/cardThumbnailSize"
                    android:layout_height="@dimen/cardThumbnailSize"
                    android:layout_gravity="end"
                    android:alpha="0.8"
                    android:contentDescription="@string/starred"
                    android:elevation="4dp"
                    android:rotationX="2"
                    android:visibility="visible"
                    app:layout_constraintEnd_toEndOf="parent"
                    app:layout_constraintTop_toTopOf="parent"
                    app:srcCompat="@drawable/loyalty_card_icon_starred"
                    tools:ignore="ImageContrastCheck"/>

            </androidx.constraintlayout.widget.ConstraintLayout>

            <androidx.constraintlayout.widget.ConstraintLayout
                android:id="@+id/archivedIcon"
                android:layout_width="match_parent"
                android:layout_height="149dp"
                android:layout_gravity="end"
                app:layout_constraintEnd_toEndOf="parent"
                app:layout_constraintHorizontal_bias="0.5"
                app:layout_constraintStart_toEndOf="@+id/thumbnail"
                tools:layout_editor_absoluteX="355dp">

                <ImageView
                    android:id="@+id/archive_background"
                    android:layout_width="@dimen/cardThumbnailSize"
                    android:layout_height="@dimen/cardThumbnailSize"
                    android:layout_gravity="end"
                    android:alpha="0.8"
                    android:contentDescription="@string/archived"
                    android:elevation="4dp"
                    android:rotationX="2"
                    android:visibility="visible"
                    app:layout_constraintStart_toStartOf="parent"
                    app:layout_constraintTop_toTopOf="parent"
                    app:srcCompat="@drawable/loyalty_card_icon_archived"
                    tools:ignore="ImageContrastCheck" />

            </androidx.constraintlayout.widget.ConstraintLayout>

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

        <TextView
            android:id="@+id/store"
            android:layout_width="match_parent"
            android:layout_height="wrap_content"
            android:layout_marginStart="8dp"
            android:layout_marginEnd="8dp"
            android:layout_marginBottom="4dp"
            android:textAppearance="?attr/textAppearanceHeadlineSmall"
            android:visibility="gone"
            tools:visibility="visible"
            app:layout_constraintTop_toBottomOf="@+id/icon_layout"
            app:layout_constraintBottom_toTopOf="@+id/note"
            app:layout_constraintEnd_toEndOf="parent"
            app:layout_constraintStart_toStartOf="parent"
            tools:text="Example store"/>

        <TextView
            android:id="@+id/note"
            android:layout_width="match_parent"
            android:layout_height="wrap_content"
            android:layout_marginStart="8dp"
            android:layout_marginEnd="8dp"
            android:layout_marginBottom="4dp"
            android:textAppearance="?attr/textAppearanceBody2"
            android:maxLines="5"
            android:ellipsize="end"
            android:visibility="gone"
            tools:visibility="visible"
            app:layout_constraintTop_toBottomOf="@+id/store"
            app:layout_constraintBottom_toTopOf="@+id/info_divider"
            app:layout_constraintEnd_toEndOf="parent"
            app:layout_constraintStart_toStartOf="parent"
            tools:text="Example note"/>

        <View
            android:id="@+id/info_divider"
            android:layout_width="match_parent"
            android:layout_height="1dp"
            android:layout_marginStart="4dp"
            android:layout_marginEnd="4dp"
            android:layout_marginBottom="8dp"
            android:background="?android:attr/dividerVertical"
            android:visibility="gone"
            tools:visibility="visible"
            app:layout_constraintTop_toBottomOf="@+id/note"
            app:layout_constraintBottom_toTopOf="@+id/cardId"
            app:layout_constraintEnd_toEndOf="parent"
            app:layout_constraintStart_toStartOf="parent"/>

        <TextView
            android:id="@+id/cardId"
            android:layout_width="match_parent"
            android:layout_height="wrap_content"
            android:gravity="center_vertical"
            android:layout_marginStart="8dp"
            android:layout_marginEnd="8dp"
            android:layout_marginBottom="4dp"
            android:textAppearance="?attr/textAppearanceBody2"
            app:drawableLeftCompat="@drawable/ic_card_id_24dp"
            android:drawablePadding="4dp"
            android:maxLines="1"
            android:ellipsize="end"
            android:visibility="gone"
            app:layout_constraintTop_toBottomOf="@+id/info_divider"
            app:layout_constraintBottom_toTopOf="@+id/balance"
            app:layout_constraintEnd_toEndOf="parent"
            app:layout_constraintStart_toStartOf="parent"
            tools:visibility="visible"
            tools:text="1234567890"/>

        <TextView
            android:id="@+id/balance"
            android:layout_width="match_parent"
            android:layout_height="wrap_content"
            android:gravity="center_vertical"
            android:layout_marginStart="8dp"
            android:layout_marginEnd="8dp"
            android:layout_marginBottom="4dp"
            android:textAppearance="?attr/textAppearanceBody2"
            app:drawableLeftCompat="@drawable/ic_baseline_payments_24"
            android:drawablePadding="4dp"
            android:visibility="gone"
            app:layout_constraintTop_toBottomOf="@+id/cardId"
            app:layout_constraintBottom_toTopOf="@+id/validFrom"
            app:layout_constraintEnd_toEndOf="parent"
            app:layout_constraintStart_toStartOf="parent"
            tools:visibility="visible"
            tools:text="525 points"/>

        <TextView
            android:id="@+id/validFrom"
            android:layout_width="match_parent"
            android:layout_height="wrap_content"
            android:gravity="center_vertical"
            android:layout_marginStart="8dp"
            android:layout_marginEnd="8dp"
            android:layout_marginBottom="4dp"
            android:textAppearance="?attr/textAppearanceBody2"
            app:drawableLeftCompat="@drawable/ic_valid_from_24dp"
            android:drawablePadding="4dp"
            android:visibility="gone"
            app:layout_constraintTop_toBottomOf="@+id/balance"
            app:layout_constraintBottom_toTopOf="@+id/expiry"
            app:layout_constraintEnd_toEndOf="parent"
            app:layout_constraintStart_toStartOf="parent"
            tools:visibility="visible"
            tools:text="Today"/>

        <TextView
            android:id="@+id/expiry"
            android:layout_width="match_parent"
            android:layout_height="wrap_content"
            android:gravity="center_vertical"
            android:layout_marginStart="8dp"
            android:layout_marginEnd="8dp"
            android:layout_marginBottom="4dp"
            android:textAppearance="?attr/textAppearanceBody2"
            app:drawableLeftCompat="@drawable/ic_baseline_access_time_24"
            android:drawablePadding="4dp"
            android:visibility="gone"
            app:layout_constraintTop_toBottomOf="@+id/validFrom"
            app:layout_constraintBottom_toBottomOf="parent"
            app:layout_constraintEnd_toEndOf="parent"
            app:layout_constraintStart_toStartOf="parent"
            tools:visibility="visible"
            tools:text="Tomorrow"/>

    </androidx.constraintlayout.widget.ConstraintLayout>
</com.google.android.material.card.MaterialCardView>
