package it.integry.integrywmsnative.view.dialogs.input_lu_prod.adapter;

import android.content.Context;
import android.widget.ArrayAdapter;

import androidx.annotation.NonNull;

import com.annimon.stream.Stream;

import java.util.List;

import it.integry.integrywmsnative.core.model.MtbTCol;

public class DialogInputLUProdTipoColloAdapter extends ArrayAdapter<DialogInputLUProdTipoColloListModel> {

    private final List<DialogInputLUProdTipoColloListModel> mDataset;

    public DialogInputLUProdTipoColloAdapter(@NonNull Context context, int resource, @NonNull List<MtbTCol> objects) {
        super(context, resource);
        this.mDataset = Stream.of(objects).map(x -> new DialogInputLUProdTipoColloListModel()
                .setOriginalModel(x))
                .toList();

        addAll(mDataset);
    }

    public List<DialogInputLUProdTipoColloListModel> getDataset() {
        return this.mDataset;
    }

    public MtbTCol getOriginalModelItem(int position) {
        return mDataset.get(position).getOriginalModel();
    }

}
