package epson.scan.activity;

import android.content.Context;
import android.view.ViewGroup;
import android.widget.BaseAdapter;

import java.util.ArrayList;
import java.util.Vector;

import epson.print.MyPrinter;
import epson.print.widgets.AbstractListBuilder;
import epson.print.widgets.PrinterInfoBuilder;
import epson.print.widgets.PrinterInfoIpBuilder;

class ScannerListAdapter {
    public static final int TYPE_IP_ADDRESS = 2;
    public static final int TYPE_LOCAL = 1;
    private AbstractListBuilder mBuilder;
    private ArrayList<Integer> mEscIVersion = new ArrayList<>();

    public ScannerListAdapter(Context context, ViewGroup viewGroup, int i) {
        switch (i) {
            case 1:
                mBuilder = new PrinterInfoIpBuilder(context, viewGroup, 1);
                break;
            case 2:
                mBuilder = new PrinterInfoBuilder(context, viewGroup, 1);
                break;
        }
        mEscIVersion.clear();
    }

    public void addPrinter(MyPrinter myPrinter) {
        AbstractListBuilder abstractListBuilder = mBuilder;
        if (abstractListBuilder instanceof PrinterInfoBuilder) {
            ((PrinterInfoBuilder) abstractListBuilder).addPrinter(myPrinter);
        }
    }

    public void addPrinter(String[] strArr) {
        mBuilder.addPrinter(strArr);
    }

    public void setResource(Object obj) {
        mBuilder.setResource(obj);
    }

    public BaseAdapter getAdapter() {
        return mBuilder.getAdapter();
    }

    public void refresh() {
        mBuilder.refresh();
    }

    public void destructor() {
        mBuilder.destructor();
    }

    public void build() {
        mBuilder.build();
    }

    public Vector<Object> getData() {
        return mBuilder.getData();
    }

    public AbstractListBuilder getBuilder() {
        return mBuilder;
    }
}
