package in.techware.carrefour.util.menuUtils;

import in.techware.carrefour.R;
import in.techware.carrefour.model.MenuBean;
import in.techware.carrefour.model.MenuListBean;
import in.techware.carrefour.util.AppConstants;

/**
 * Created by Jemsheer K D on 14 July, 2018.
 * Package in.techware.carrefour.util.menuUtils
 * Project Carrefour
 */
public class ReceiveMenuUtil {

    public static final String CODE_RECEIVING = "1";
    public static final String CODE_RETURN = "2";
    public static final String CODE_PRICE_SURVEY = "3";
    public static final String CODE_RESTORE = "4";
    public static final String CODE_STORE_TO_OFFSITE = "5";
    public static final String CODE_OFFSITE_TO_STORE = "6";
    public static final String CODE_COMPETITION = "7";
    public static final String CODE_EXIT = "8";

    public static MenuListBean getAllMenu() {
        return BaseMenuUtil.getAllMenu(R.array.menu_receive);
    }

    public static String getFileName(MenuBean menuBean, int type) {
        switch (menuBean.getCode()) {
            case ReceiveMenuUtil.CODE_RECEIVING:
                return AppConstants.addWorkFolderPrefix(AppConstants.FILE_PREFIX_RECEIVING);
            case ReceiveMenuUtil.CODE_RETURN:
                return AppConstants.addWorkFolderPrefix(AppConstants.FILE_PREFIX_RETURN);
            case ReceiveMenuUtil.CODE_PRICE_SURVEY:
                return AppConstants.addWorkFolderPrefix(AppConstants.FILE_PREFIX_PRICE_SURVEY);
            case ReceiveMenuUtil.CODE_RESTORE:
                if (type == AppConstants.RESTORE_TYPE_RECEIVING) {
                    return AppConstants.addSentFolderPrefix(AppConstants.FILE_PREFIX_RECEIVING);

                } else if (type == AppConstants.RESTORE_TYPE_RETURN) {
                    return AppConstants.addSentFolderPrefix(AppConstants.FILE_PREFIX_RETURN);

                } else if (type == AppConstants.RESTORE_TYPE_PRICE_SURVEY) {
                    return AppConstants.addSentFolderPrefix(AppConstants.FILE_PREFIX_PRICE_SURVEY);

                } else if (type == AppConstants.RESTORE_TYPE_STORE_TO_OFFSITE) {
                    return AppConstants.addSentFolderPrefix(AppConstants.FILE_PREFIX_TRANS_STOR_TO_OFFSITE);

                } else if (type == AppConstants.RESTORE_TYPE_OFFSITE_TO_STORE) {
                    return AppConstants.addSentFolderPrefix(AppConstants.FILE_PREFIX_TRANS_OFFSITE_TO_STORE);

                } else {
                    return "";
                }
            case ReceiveMenuUtil.CODE_STORE_TO_OFFSITE:
                return AppConstants.addWorkFolderPrefix(AppConstants.FILE_PREFIX_TRANS_STOR_TO_OFFSITE);
            case ReceiveMenuUtil.CODE_OFFSITE_TO_STORE:
                return AppConstants.addWorkFolderPrefix(AppConstants.FILE_PREFIX_TRANS_OFFSITE_TO_STORE);
            case ReceiveMenuUtil.CODE_COMPETITION:
                return AppConstants.addWorkFolderPrefix(AppConstants.FILE_PREFIX_COMPETITION);
            case ReceiveMenuUtil.CODE_EXIT:
            default:
                return "";
        }
    }
}
