package it.integry.integrywmsnative.core.class_router.configs;

import androidx.annotation.DrawableRes;
import androidx.annotation.IdRes;
import androidx.annotation.StringRes;
import androidx.fragment.app.Fragment;

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

import it.integry.integrywmsnative.core.expansion.RunnableWithReturn;

public class BaseMenuConfiguration {


    protected List<MenuConfiguration.MenuGroup> groups = new ArrayList<>();

    public BaseMenuConfiguration addGroup(MenuGroup menuGroup) {
        this.groups.add(menuGroup);
        return this;
    }

    public List<MenuGroup> getGroups() {
        return groups;
    }


    public static class MenuGroup {
        @StringRes
        private int mGroupText;

        @IdRes
        private int mGroupId;

        private String codMenu;

        private List<MenuItem> mItems = new ArrayList<>();

        public @IdRes int getGroupId() {
            return mGroupId;
        }

        public MenuGroup setGroupId(@IdRes int mGroupId) {
            this.mGroupId = mGroupId;
            return this;
        }

        public @StringRes int getGroupText() {
            return mGroupText;
        }

        public MenuGroup setGroupText(@StringRes int groupText) {
            mGroupText = groupText;
            return this;
        }

        public String getCodMenu() {
            return codMenu;
        }

        public MenuGroup setCodMenu(String codMenu) {
            this.codMenu = codMenu;
            return this;
        }

        public List<MenuItem> getItems() {
            return mItems;
        }

        public MenuGroup addItem(MenuItem item) {
            this.mItems.add(item);
            return this;
        }
    }

    public static class MenuItem {
        @IdRes private int mID;
        @StringRes private int mTitleText;
        @DrawableRes private int mTitleIcon;
        @DrawableRes private int mDrawerIcon;
        private String codMenu;
        private RunnableWithReturn<Fragment> fragmentFactory;

        public int getID() {
            return mID;
        }

        public MenuItem setID(@IdRes int ID) {
            this.mID = ID;
            return this;
        }

        public int getTitleText() {
            return mTitleText;
        }

        public MenuItem setTitleText(@StringRes int titleText) {
            mTitleText = titleText;
            return this;
        }

        public int getTitleIcon() {
            return mTitleIcon;
        }

        public MenuItem setTitleIcon(@DrawableRes int titleIcon) {
            mTitleIcon = titleIcon;
            return this;
        }

        public int getDrawerIcon() {
            return mDrawerIcon;
        }

        public MenuItem setDrawerIcon(@DrawableRes int drawerIcon) {
            mDrawerIcon = drawerIcon;
            return this;
        }

        public String getCodMenu() {
            return codMenu;
        }

        public MenuItem setCodMenu(String codMenu) {
            this.codMenu = codMenu;
            return this;
        }

        public RunnableWithReturn<Fragment> getFragmentFactory() {
            return fragmentFactory;
        }

        public MenuItem setFragmentFactory(RunnableWithReturn<Fragment> fragmentFactory) {
            this.fragmentFactory = fragmentFactory;
            return this;
        }
    }


}
