<?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="com.yidian.shenghuoquan.buserorder.manager.OrderStatus" />

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

        <variable
            name="vm"
            type="com.yidian.shenghuoquan.buserorder.viewmodel.OrderStatusViewModel" />

        <variable
            name="status"
            type="com.yidian.shenghuoquan.buserorder.manager.OrderStatus" />

        <variable
            name="data"
            type="com.yidian.shenghuoquan.buserorder.dto.OrderDetailDto" />
    </data>

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

        <ImageView
            android:id="@+id/iv_order_status"
            android:layout_width="@dimen/dp24"
            android:layout_height="@dimen/dp24"
            app:layout_constraintBottom_toBottomOf="@id/tv_order_sub_status"
            app:layout_constraintStart_toStartOf="parent"
            app:layout_constraintTop_toTopOf="@id/tv_order_status"
            app:orderStatusImage="@{status}"
            tools:src="@drawable/icon_order_status_paid" />

        <TextView
            android:id="@+id/tv_order_status"
            android:layout_width="wrap_content"
            android:layout_height="wrap_content"
            android:layout_marginStart="@dimen/dp8"
            android:text="@{data.orderStatusText}"
            android:textColor="@color/color_333333"
            android:textSize="@dimen/sp22"
            android:textStyle="bold"
            app:layout_constraintStart_toEndOf="@id/iv_order_status"
            app:layout_constraintTop_toTopOf="parent"
            tools:text="已支付" />

        <TextView
            android:id="@+id/tv_order_sub_status"
            android:layout_width="wrap_content"
            android:layout_height="wrap_content"
            android:layout_marginStart="@dimen/dp8"
            android:layout_marginTop="@dimen/dp8"
            android:textColor="@color/color_666666"
            android:textSize="@dimen/sp14"
            android:visibility="@{status == OrderStatus.ORDER_STATUS_WAIT_REFUND || status == OrderStatus.ORDER_STATUS_REFUNDED || status == OrderStatus.ORDER_STATUS_REFUSE_REFUND || status == OrderStatus.ORDER_STATUS_PART_REFUND ? View.VISIBLE : View.GONE}"
            app:layout_constraintStart_toEndOf="@id/iv_order_status"
            app:layout_constraintTop_toBottomOf="@id/tv_order_status"
            app:orderRefundAmount="@{data.refundAmount}"
            app:orderStatusDescription="@{status}"
            tools:text="待商家确认" />

    </androidx.constraintlayout.widget.ConstraintLayout>
</layout>