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.JtbFasi;

public class DialogInputLULineeProdAdapter extends ArrayAdapter<DialogInputLULineeProdListModel> {

    private final List<DialogInputLULineeProdListModel> mDataset;

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

        addAll(mDataset);
    }

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

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