package com.yidian.shenghuoquan.border.ui.widget

import android.content.Context
import android.util.AttributeSet
import android.view.LayoutInflater
import androidx.constraintlayout.widget.ConstraintLayout
import androidx.databinding.DataBindingUtil
import com.yidian.shenghuoquan.border.R
import com.yidian.shenghuoquan.border.databinding.BorderViewOrderStatusBinding
import com.yidian.shenghuoquan.border.dto.OrderDetailDto
import com.yidian.shenghuoquan.border.manager.OrderStatus
import com.yidian.shenghuoquan.border.viewmodel.OrderStatusViewModel

/**
 * author: yinjiacheng
 * date: 2021/8/21 09:57
 * description: 订单详情页-订单状态
 */
class OderStatusView @JvmOverloads constructor(context: Context, attrs: AttributeSet? = null, defStyle: Int = 0) :
  ConstraintLayout(context, attrs, defStyle) {

  private val binding =
    DataBindingUtil.inflate<BorderViewOrderStatusBinding>(LayoutInflater.from(getContext()), R.layout.border_view_order_status, this, true)

  /**
   * 设置订单状态
   * @param status 订单状态
   * @param data 订单详情
   */
  fun setOrderStatus(status: OrderStatus, data: OrderDetailDto) {
    binding.vm = OrderStatusViewModel()
    binding.status = status
    binding.data = data
  }
}
