package com.gingersoft.gsa.cloud.pay.mvp.ui.adapter;

import com.chad.library.adapter.base.BaseQuickAdapter;
import com.chad.library.adapter.base.viewholder.BaseViewHolder;
import com.gingersoft.gsa.cloud.common.constans.AppConstans;
import com.gingersoft.gsa.cloud.order.billItem.BillItem;
import com.gingersoft.gsa.cloud.pay.R;

import org.jetbrains.annotations.NotNull;
import org.jetbrains.annotations.Nullable;

import java.util.List;

/**
 * @作者: bin
 * @創建時間: 2020-12-28 17:34
 * @更新時間: 2020-12-28 17:34
 * @描述:
 */
public class ResultBillItemAdapter extends BaseQuickAdapter<BillItem, BaseViewHolder> {

    private List<BillItem> mBillItemList;

    private final byte BILL_ITEM = 1;
    private final byte PAY_METHOD = 2;

    public ResultBillItemAdapter(@Nullable List<BillItem> data) {
        super(R.layout.pay_item_billl_item,data);
        this.mBillItemList = data;

//        setMultiTypeDelegate(new BaseMultiTypeDelegate<PayResultBillItem>() {
//            @Override
//            public int getItemType(@NotNull List<? extends PayResultBillItem> list, int i) {
//                if (list.get(i).getItemType() == 2) {
//                    return PAY_METHOD;
//                } else {
//                    return BILL_ITEM;
//                }
//            }
//        });
//        getMultiTypeDelegate().
//                addItemType(PAY_METHOD, R.layout.pay_item_pay_method)
//                .addItemType(BILL_ITEM, R.layout.pay_item_billl_item);
    }

    @Override
    protected void convert(@NotNull BaseViewHolder baseViewHolder, BillItem billItem) {
//        if (baseViewHolder.getItemViewType() == PAY_METHOD) {
//            baseViewHolder.setText(R.id.tv_pay_method, billItem.getName());
//        } else {
            baseViewHolder.setText(R.id.tv_name, billItem.getName());
            baseViewHolder.setText(R.id.tv_money, AppConstans.CARSH_STR + billItem.getMoney());
            baseViewHolder.setBackgroundColor(R.id.ll_container,billItem.getBgColor());
//        }
    }

}
