package com.gingersoft.gsa.cloud.table.di.module;

import androidx.recyclerview.widget.GridLayoutManager;
import androidx.recyclerview.widget.LinearLayoutManager;

import com.gingersoft.gsa.cloud.database.bean.ComboItem;
import com.gingersoft.gsa.cloud.database.bean.Food;
import com.gingersoft.gsa.cloud.database.bean.Modifier;
import com.gingersoft.gsa.cloud.table.mvp.contract.SetMealContract;
import com.gingersoft.gsa.cloud.table.mvp.ui.adapter.meal.ComboAdapter;
import com.gingersoft.gsa.cloud.table.mvp.ui.adapter.meal.FoodAdapter;
import com.gingersoft.gsa.cloud.table.mvp.ui.adapter.meal.FoodGroupAdapter;
import com.gingersoft.gsa.cloud.table.mvp.ui.adapter.meal.ModifierAdapter;
import com.jess.arms.di.scope.FragmentScope;
import com.jess.arms.di.scope.FragmentScope;

import dagger.Binds;
import dagger.Module;
import dagger.Provides;

import com.gingersoft.gsa.cloud.table.mvp.contract.SetMealContract;
import com.gingersoft.gsa.cloud.table.mvp.model.SetMealModel;
import com.jess.arms.mvp.IView;

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

import javax.inject.Named;


/**
 * ================================================
 * Description:
 * <p>
 * Created by MVPArmsTemplate on 04/17/2021 10:40
 * <a href="mailto:jess.yan.effort@gmail.com">Contact me</a>
 * <a href="https://github.com/JessYanCoding">Follow me</a>
 * <a href="https://github.com/JessYanCoding/MVPArms">Star me</a>
 * <a href="https://github.com/JessYanCoding/MVPArms/wiki">See me</a>
 * <a href="https://github.com/JessYanCoding/MVPArmsTemplate">模版请保持更新</a>
 * ================================================
 */
@Module
public abstract class SetMealModule {

    @Binds
    abstract SetMealContract.Model bindSetMealModel(SetMealModel model);

    @FragmentScope
    @Provides
    @Named("foodGroupList")
    static List<Food> provideFoodGroupList() {
        return new ArrayList<>();
    }

    @FragmentScope
    @Provides
    @Named("foodList")
    static List<Food> provideFoodList() {
        return new ArrayList<>();
    }

    @FragmentScope
    @Provides
    static List<ComboItem> provideFoodCombo() {
        return new ArrayList<>();
    }

    @FragmentScope
    @Provides
    static List<Modifier> provideModifierList() {
        return new ArrayList<>();
    }


    @FragmentScope
    @Provides
    @Named("fineTabTitles")
    static List<String> provideFineTabTitleList() {
        return new ArrayList<>();
    }

    @FragmentScope
    @Provides
    static FoodGroupAdapter provideFoodGroupAdapter(SetMealContract.View IView, @Named("foodGroupList") List<Food> foodGroupList) {
        return new FoodGroupAdapter(IView.getActivity2(), foodGroupList, IView.getFromType());
    }

    @FragmentScope
    @Provides
    static FoodAdapter provideFoodAdapter(SetMealContract.View IView, @Named("foodList") List<Food> foodList) {
        return new FoodAdapter(IView.getActivity2(), foodList, IView.getFromType());
    }

    @FragmentScope
    @Provides
    static ComboAdapter provideComboAdapter(SetMealContract.View IView, List<ComboItem> comboItemList) {
        return new ComboAdapter(IView.getActivity2(), comboItemList);
    }

    @FragmentScope
    @Provides
    static ModifierAdapter provideModifierAdapter(SetMealContract.View IView, List<Modifier> modifierList) {
        return new ModifierAdapter(IView.getActivity2(), modifierList);
    }

    @Named("foodGridLayoutManager")
    @FragmentScope
    @Provides
    static GridLayoutManager provideFoodRecycleLayoutManager(SetMealContract.View IView) {
        return new GridLayoutManager(IView.getActivity2(), 1, LinearLayoutManager.HORIZONTAL, false);
    }

    @Named("comboGridLayoutManager")
    @FragmentScope
    @Provides
    static GridLayoutManager provideComboRecycleLayoutManager(SetMealContract.View IView) {
        return new GridLayoutManager(IView.getActivity2(), 1, LinearLayoutManager.HORIZONTAL, false);
    }

    @Named("modifierGridLayoutManager")
    @FragmentScope
    @Provides
    static GridLayoutManager provideModifierRecycleLayoutManager(SetMealContract.View IView) {
        return new GridLayoutManager(IView.getActivity2(), 1, LinearLayoutManager.HORIZONTAL, false);
    }


}