package com.navinfo.outdoor.adapter;

import android.content.Context;
import android.view.LayoutInflater;
import android.view.View;
import android.view.ViewGroup;
import android.widget.TextView;

import androidx.annotation.NonNull;
import androidx.recyclerview.widget.RecyclerView;

import com.navinfo.outdoor.R;
import com.navinfo.outdoor.bean.HasSubmitBean;

import org.jetbrains.annotations.NotNull;

import java.util.ArrayList;
import java.util.List;

public class PoiTaskAdapter extends RecyclerView.Adapter<PoiTaskAdapter.ViewHolder> {
    private Context context;
    private List<HasSubmitBean.BodyBean.ListBean> listBeans ;


    public PoiTaskAdapter(Context context, List<HasSubmitBean.BodyBean.ListBean> listBeans) {
        this.context = context;
        this.listBeans = listBeans;
    }

    @NonNull
    @NotNull
    @Override
    public ViewHolder onCreateViewHolder(@NonNull @NotNull ViewGroup parent, int viewType) {
        View inflate = LayoutInflater.from(context).inflate(R.layout.has_sumit_item, parent, false);
        return new ViewHolder(inflate);
    }

    @Override
    public void onBindViewHolder(@NonNull @NotNull ViewHolder holder, int position) {
        HasSubmitBean.BodyBean.ListBean listBean = listBeans.get(position);
        holder.tvnName.setText(listBean.getName()+"");
        holder.tvTime.setText(listBean.getCreateTime()+"");
        if (listBean.getAuditStatus()==0){
            holder.tvAuditStatus.setText("审核通过");
        }else if (listBean.getAuditStatus() == 1){
            holder.tvAuditStatus.setText("审核未通过");
            holder.tvMassage.setText(listBean.getAuditMsg());
        }else if (listBean.getAuditStatus() == -1){
            holder.tvAuditStatus.setText("待审核");
        }

        holder.tvMany.setText("￥0.0");
    }

    @Override
    public int getItemCount() {
        return listBeans.size();
    }

    public class ViewHolder extends RecyclerView.ViewHolder {
        TextView tvnName, tvTime, tvMany, tvMassage ,tvAuditStatus;

        public ViewHolder(@NonNull @NotNull View itemView) {
            super(itemView);
            tvnName = itemView.findViewById(R.id.tv_has_name);
            tvTime = itemView.findViewById(R.id.tv_createTime);
             tvAuditStatus= itemView.findViewById(R.id.tv_auditStatus);
            tvMassage = itemView.findViewById(R.id.tv_auditMsg);
            tvMany = itemView.findViewById(R.id.tv_many);
        }
    }
}
