<?xml version="1.0" encoding="utf-8"?>
<androidx.constraintlayout.widget.ConstraintLayout 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/item_layout"
    android:layout_width="match_parent"
    android:layout_height="wrap_content"
    android:layout_marginHorizontal="12dp"
    android:layout_marginBottom="24dp"
    android:clickable="true"
    android:focusable="true"
    android:foreground="@drawable/ripple_background"
    android:orientation="vertical">

    <com.google.android.material.imageview.ShapeableImageView
        android:id="@+id/item_image"
        android:layout_width="0dp"
        android:layout_height="0dp"
        android:scaleType="centerCrop"
        app:layout_constraintDimensionRatio="H,2:3"
        app:layout_constraintEnd_toEndOf="parent"
        app:layout_constraintStart_toStartOf="parent"
        app:layout_constraintTop_toTopOf="parent"
        app:shapeAppearanceOverlay="@style/ShapeAppearanceOverlay.Findroid.Image" />

    <TextView
        android:id="@+id/item_name"
        android:layout_width="wrap_content"
        android:layout_height="wrap_content"
        android:layout_marginTop="4dp"
        android:ellipsize="end"
        android:maxLines="2"
        android:textAppearance="@style/TextAppearance.Material3.BodyMedium"
        app:layout_constraintStart_toStartOf="parent"
        app:layout_constraintTop_toBottomOf="@id/item_image"
        tools:text="Movie title" />

    <LinearLayout
        android:layout_width="wrap_content"
        android:layout_height="wrap_content"
        android:layout_marginTop="8dp"
        android:layout_marginEnd="8dp"
        android:orientation="horizontal"
        app:layout_constraintEnd_toEndOf="@id/item_image"
        app:layout_constraintTop_toTopOf="@id/item_image">

        <ImageView
            android:id="@+id/downloaded_icon"
            android:layout_width="24dp"
            android:layout_height="24dp"
            android:layout_marginStart="8dp"
            android:background="@drawable/circle_background"
            android:contentDescription="@string/downloaded_indicator"
            android:padding="4dp"
            android:src="@drawable/ic_download"
            android:visibility="gone"
            app:tint="?attr/colorOnPrimary"
            tools:visibility="visible" />

        <TextView
            android:id="@+id/item_count"
            android:layout_width="wrap_content"
            android:layout_height="24dp"
            android:layout_marginStart="8dp"
            android:background="@drawable/bg_rounded_rect_12dp"
            android:gravity="center"
            android:minWidth="24dp"
            android:paddingHorizontal="8dp"
            android:textAppearance="@style/TextAppearance.Material3.BodySmall"
            android:textColor="?attr/colorOnPrimary"
            app:layout_constraintEnd_toEndOf="parent"
            app:layout_constraintTop_toTopOf="parent"
            tools:text="9" />

        <ImageView
            android:id="@+id/played_icon"
            android:layout_width="24dp"
            android:layout_height="24dp"
            android:layout_marginStart="8dp"
            android:background="@drawable/circle_background"
            android:contentDescription="@string/episode_watched_indicator"
            android:padding="4dp"
            android:src="@drawable/ic_check"
            app:layout_constraintEnd_toEndOf="@id/item_image"
            app:layout_constraintTop_toTopOf="@id/item_image"
            app:tint="?attr/colorOnPrimary" />

    </LinearLayout>

</androidx.constraintlayout.widget.ConstraintLayout>
