<?xml version="1.0" encoding="utf-8"?>

<layout 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">

    <data>

        <import type="it.integry.integrywmsnative.R" />

        <import type="androidx.core.content.ContextCompat" />

        <import type="it.integry.integrywmsnative.core.utility.UtilityNumber" />

        <import type="android.view.View" />


        <import type="it.integry.integrywmsnative.core.utility.UtilityString" />

        <import type="it.integry.integrywmsnative.core.utility.UtilityDate" />

        <variable
            type="it.integry.integrywmsnative.gest.prod_dettaglio_linea.dialogs.BottomSheetLineAction"
            name="view" />

        <variable
            type="it.integry.integrywmsnative.gest.prod_linee_produzione.dto.ProdLineStatusDTO"
            name="listModel" />


    </data>

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

        <androidx.appcompat.widget.LinearLayoutCompat
            android:id="@+id/descriptionLayout"
            android:layout_width="0dp"
            android:layout_height="wrap_content"
            android:orientation="vertical"
            app:layout_constraintEnd_toEndOf="parent"
            app:layout_constraintHorizontal_bias="0.0"
            app:layout_constraintStart_toStartOf="parent"
            app:layout_constraintTop_toTopOf="parent">

            <androidx.appcompat.widget.LinearLayoutCompat
                android:id="@+id/mtb_grp_container"
                android:layout_width="match_parent"
                android:layout_height="wrap_content"
                android:padding="4dp"
                android:orientation="horizontal">

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


                    <androidx.appcompat.widget.AppCompatTextView
                        style="@style/AppTheme.NewMaterial.Text.Large"
                        android:layout_width="wrap_content"
                        android:layout_height="wrap_content"
                        android:text="@{listModel.getLabel()}"
                        android:textColor="@{ContextCompat.getColor(context,listModel.isStarted() ? R.color.green_600 : listModel.isPaused() ? R.color.orange_600 : R.color.red_600)}"
                        android:textSize="16sp"
                        android:textStyle="bold"
                        tools:text="L2 - Linea 2"
                        tools:textColor="@color/green_600" />

                    <androidx.appcompat.widget.LinearLayoutCompat
                        android:layout_width="wrap_content"
                        android:layout_height="wrap_content"
                        android:layout_alignParentEnd="true"
                        android:layout_centerVertical="true"
                        android:background="@drawable/badge_round_corner"
                        android:backgroundTint="@{ContextCompat.getColor(context, listModel.isStarted() ? R.color.green_600 : listModel.isPaused() ? R.color.orange_600 : R.color.red_600)}"
                        android:orientation="horizontal"
                        android:weightSum="2"
                        tools:backgroundTint="@color/green_600">

                        <androidx.appcompat.widget.AppCompatImageView
                            android:id="@+id/image"
                            android:layout_width="18dp"
                            android:layout_height="19dp"
                            android:layout_gravity="center_horizontal"
                            android:src="@{ContextCompat.getDrawable(context, listModel.isStarted() ? R.drawable.ic_baseline_play_arrow_24 : listModel.isPaused() ? R.drawable.ic_baseline_pause_24 : R.drawable.ic_baseline_stop_24)}"
                            app:tint="@color/white"
                            tools:src="@drawable/ic_baseline_play_arrow_24" />

                        <androidx.appcompat.widget.AppCompatTextView
                            android:id="@+id/peso_lordo_collo"
                            android:layout_width="wrap_content"
                            android:layout_height="wrap_content"
                            android:text="@{listModel.isStarted() ? R.string.in_progress : listModel.isPaused() ? R.string.stand_by : R.string.stopped}"
                            android:textAppearance="@style/AppTheme.NewMaterial.Text.Medium"
                            android:textColor="@android:color/white"
                            android:textStyle="bold"
                            tools:text="In lavorazione" />
                    </androidx.appcompat.widget.LinearLayoutCompat>

                </RelativeLayout>

            </androidx.appcompat.widget.LinearLayoutCompat>

            <androidx.appcompat.widget.LinearLayoutCompat
                android:id="@+id/lista_ords_container"
                android:layout_width="match_parent"
                android:layout_height="wrap_content"
                android:padding="4dp"
                android:orientation="horizontal"
                android:visibility="@{listModel.isStarted() &amp;&amp; !UtilityString.isNullOrEmpty(listModel.listaOrd) ? View.VISIBLE : View.GONE}">

                <androidx.appcompat.widget.AppCompatTextView
                    android:layout_width="wrap_content"
                    android:layout_height="wrap_content"
                    android:layout_marginEnd="8dp"
                    android:text="@string/orders_in_progress"
                    android:textColor="@android:color/black"
                    android:textSize="14sp" />

                <androidx.appcompat.widget.AppCompatTextView
                    android:id="@+id/lista_ords"
                    android:layout_width="wrap_content"
                    android:layout_height="wrap_content"
                    android:text="@{listModel.listaOrd}"
                    android:textColor="@android:color/black"
                    android:textSize="14sp"
                    android:textStyle="bold"
                    tools:text="125|255" />

            </androidx.appcompat.widget.LinearLayoutCompat>

            <androidx.appcompat.widget.LinearLayoutCompat
                android:layout_width="match_parent"
                android:layout_height="wrap_content"
                android:background="?attr/selectableItemBackground"
                android:clickable="true"
                android:focusable="true"
                android:onClick="@{()->view.onResourcesClicked()}"
                android:orientation="horizontal"
                android:padding="16dp">

                <androidx.appcompat.widget.AppCompatImageView
                    android:layout_width="wrap_content"
                    android:layout_height="wrap_content"
                    android:src="@drawable/ic_baseline_person_add_24" />

                <androidx.appcompat.widget.AppCompatTextView
                    style="@style/TextAppearance.Material3.BodyLarge"
                    android:layout_width="wrap_content"
                    android:layout_height="wrap_content"
                    android:layout_marginStart="32dp"
                    android:text="@string/ridistribuisci_risorse" />

            </androidx.appcompat.widget.LinearLayoutCompat>

            <androidx.appcompat.widget.LinearLayoutCompat
                android:layout_width="match_parent"
                android:layout_height="wrap_content"
                android:background="?attr/selectableItemBackground"
                android:clickable="true"
                android:focusable="true"
                android:onClick="@{()->view.onPlayClicked()}"
                android:orientation="horizontal"
                android:padding="16dp">

                <androidx.appcompat.widget.AppCompatImageView
                    android:layout_width="wrap_content"
                    android:layout_height="wrap_content"
                    android:src="@drawable/ic_baseline_play_arrow_24" />

                <androidx.appcompat.widget.AppCompatTextView
                    style="@style/TextAppearance.Material3.BodyLarge"
                    android:layout_width="wrap_content"
                    android:layout_height="wrap_content"
                    android:layout_marginStart="32dp"
                    android:text="@string/avvia_nuova_produzione" />

            </androidx.appcompat.widget.LinearLayoutCompat>

            <androidx.appcompat.widget.LinearLayoutCompat
                android:layout_width="match_parent"
                android:layout_height="wrap_content"
                android:background="?attr/selectableItemBackground"
                android:clickable="true"
                android:focusable="true"
                android:onClick="@{()->view.onStopClicked()}"
                android:orientation="horizontal"
                android:padding="16dp">

                <androidx.appcompat.widget.AppCompatImageView
                    android:layout_width="wrap_content"
                    android:layout_height="wrap_content"
                    android:src="@drawable/ic_baseline_stop_24" />

                <androidx.appcompat.widget.AppCompatTextView
                    style="@style/TextAppearance.Material3.BodyLarge"
                    android:layout_width="wrap_content"
                    android:layout_height="wrap_content"
                    android:layout_marginStart="32dp"
                    android:text="@string/arresta_produzione" />

            </androidx.appcompat.widget.LinearLayoutCompat>

            <androidx.appcompat.widget.LinearLayoutCompat
                android:layout_width="match_parent"
                android:layout_height="wrap_content"
                android:background="?attr/selectableItemBackground"
                android:clickable="true"
                android:focusable="true"
                android:onClick="@{()->view.onRecoverClicked()}"
                android:orientation="horizontal"
                android:padding="16dp">

                <androidx.appcompat.widget.AppCompatImageView
                    android:layout_width="wrap_content"
                    android:layout_height="wrap_content"
                    android:src="@drawable/ic_black_download" />

                <androidx.appcompat.widget.AppCompatTextView
                    style="@style/TextAppearance.Material3.BodyLarge"
                    android:layout_width="wrap_content"
                    android:layout_height="wrap_content"
                    android:layout_marginStart="32dp"
                    android:text="@string/prod_recupero_materiale_title_fragment" />

            </androidx.appcompat.widget.LinearLayoutCompat>


        </androidx.appcompat.widget.LinearLayoutCompat>


    </androidx.constraintlayout.widget.ConstraintLayout>

</layout>