package ch.pizzalemon.android.adapter.pager;

import androidx.fragment.app.Fragment;
import androidx.fragment.app.FragmentManager;
import androidx.fragment.app.FragmentPagerAdapter;

import java.util.ArrayList;

import ch.pizzalemon.android.fragment.CampaignBannerFragment;
import ch.pizzalemon.android.model.CampaignBannerModel;

public class CampaignBannerPagerAdapter extends FragmentPagerAdapter {

    private ArrayList<CampaignBannerModel> campaignBannerList = new ArrayList<>();

    public CampaignBannerPagerAdapter(FragmentManager fm,
                                      ArrayList<CampaignBannerModel> campaignBannerList) {
        super(fm);
        this.campaignBannerList = campaignBannerList;
    }

    @Override
    public Fragment getItem(int position) {
        return CampaignBannerFragment.newInstance(campaignBannerList.get(position));
    }

    @Override
    public int getCount() {
        return campaignBannerList.size();
    }
}