package in.techware.carrefour.util;

import android.widget.Toast;

import com.google.gson.Gson;

import in.techware.carrefour.R;
import in.techware.carrefour.app.App;
import in.techware.carrefour.model.CountryBean;
import in.techware.carrefour.model.CountryListBean;
import in.techware.carrefour.model.MenuBean;
import in.techware.carrefour.net.ServiceNames;
import in.techware.carrefour.util.menuUtils.ELIEMenuUtil;
import in.techware.carrefour.util.menuUtils.HomeMenuUtil;
import in.techware.carrefour.util.menuUtils.ITMenuUtil;
import in.techware.carrefour.util.menuUtils.MerchandiseMenuUtil;
import in.techware.carrefour.util.menuUtils.OrderMenuUtil;
import in.techware.carrefour.util.menuUtils.ReceiveMenuUtil;

public class AppConstants {


    public static final String UTF_8 = "UTF-8";
    public static final String MIME_TYPE_HTML = "text/html";

    public static final String SPACE = " ";
    public static final String COMMA = App.getInstance().getString(R.string.comma) + SPACE;
    public static final String AND = SPACE + App.getInstance().getString(R.string.and) + SPACE;
    public static final String SEPARATOR = "/";
    public static final String BASE_URL = ServiceNames.API_UPLOADS;

    private static final int COUNTRY_TYPE_ID = 0;
    private static final int COUNTRY_TYPE_DIALCODE = 1;
    private static final int COUNTRY_TYPE_NAME = 2;
    private static final int COUNTRY_TYPE_COUNTRY_CODE = 3;

    private static final int LANGUAGE_TYPE_ID = 0;
    private static final int LANGUAGE_TYPE_SHORTCODE = 1;
    private static final int LANGUAGE_TYPE_NAME = 2;

    public static final String PREF_FILE = "File";
    public static final String KEYBOARD_STATUS = "keyboard_status";

    public static String WEB_ERROR_MSG = App.getInstance().getResources().getString(R.string.message_web_error);
    public static String NO_NETWORK_AVAILABLE = App.getInstance().getResources().getString(R.string.message_no_network_available);

    public static String EXTRA_PROFILE_TO_IMAGE_MEDIA_LIST = "imageList";
    public static String EXTRA_PROFILE_TO_IMAGE_SELECTED_POSITION = "imagePosition";
    public static String EXTRA_PROFILE_TO_IMAGE_LIST_SIZE = "imageListSize";


    public static final String PREFERENCE_KEY_SESSION_FCM_ID = "fcm_id";
    public static final String PREFERENCE_KEY_SESSION_TOKEN = "auth_token";
    public static final String PREFERENCE_KEY_SESSION_DEVICE_ID = "device_id";
    public static final String PREFERENCE_KEY_SESSION_DEVICE_SECRET = "device_secret";
    public static final String PREFERENCE_KEY_SESSION_ACCESSTOKEN = "access_token";
    public static final String PREFERENCE_KEY_SESSION_REFRESHTOKEN = "refresh_token";
    public static final String PREFERENCE_KEY_SESSION_USERNAME = "username";
    public static final String PREFERENCE_KEY_SESSION_NAME = "name";
    public static final String PREFERENCE_KEY_SESSION_FIRSTNAME = "firstname";
    public static final String PREFERENCE_KEY_SESSION_LASTNAME = "lastname";
    public static final String PREFERENCE_KEY_SESSION_EMAIL = "email";
    public static final String PREFERENCE_KEY_SESSION_PHONE = "phone";
    public static final String PREFERENCE_KEY_SESSION_ADDRESS = "address";
    public static final String PREFERENCE_KEY_SESSION_PROFILE_PHOTO = "profile_photo";
    public static final String PREFERENCE_KEY_SESSION_COVER_PHOTO = "cover_photo";
    public static final String PREFERENCE_KEY_SESSION_USERID = "userid";
    public static final String PREFERENCE_KEY_SESSION_PASSWORD = "password";
    public static final String PREFERENCE_KEY_SESSION_GENDER = "gender";
    public static final String PREFERENCE_KEY_SESSION_IS_FIRST_TIME = "is_first_time";
    public static final String PREFERENCE_KEY_SESSION_IS_PHONE_VERIFIED = "is_phone_verified";
    public static final String PREFERENCE_KEY_SESSION_IS_EMAIL_VERIFIED = "is_email_verified";
    public static final String PREFERENCE_KEY_SESSION_DOB = "dob";
    public static final String PREFERENCE_KEY_SESSION_LOCALE = "locale";
    public static final String PREFERENCE_NAME_SESSION = "session";


    public static String ACTION_CHOOSE_ORIGIN = "in.techware.carrefour.action.CHOOSE_ORIGIN";
    public static String ACTION_CHOOSE_PRINTER = "in.techware.carrefour.action.CHOOSE_PRINTER";
    public static String ACTION_CHOOSE_DEPARTMENT = "in.techware.carrefour.action.CHOOSE_DEPARTMENT";
    public static String ACTION_CHOOSE_SECTION = "in.techware.carrefour.action.CHOOSE_SECTION";
    public static String ACTION_CHOOSE_GONDOLA = "in.techware.carrefour.action.CHOOSE_GONDOLA";
    public static String ACTION_CHOOSE_PREFIX = "in.techware.carrefour.action.CHOOSE_PREFIX";
    public static String ACTION_CHOOSE_SUFFIX = "in.techware.carrefour.action.CHOOSE_SUFFIX";
    public static String ACTION_CHOOSE_MONTH = "in.techware.carrefour.action.CHOOSE_MONTH";
    public static String ACTION_CHOOSE_DAY = "in.techware.carrefour.action.CHOOSE_DAY";
    public static String ACTION_CHOOSE_YEAR = "in.techware.carrefour.action.CHOOSE_YEAR";
    public static String ACTION_CHOOSE_RELIGION = "in.techware.carrefour.action.CHOOSE_RELIGION";
    public static String ACTION_CHOOSE_COUNTRY = "in.techware.carrefour.action.CHOOSE_COUNTRY";
    public static String ACTION_CHOOSE_STATE = "in.techware.carrefour.action.CHOOSE_STATE";
    public static String ACTION_CHOOSE_DISTRICT = "in.techware.carrefour.action.CHOOSE_CITY";
    public static String ACTION_CHOOSE_AGE = "in.techware.carrefour.action.CHOOSE_AGE";
    public static String ACTION_CHOOSE_CAUSE_OF_DEATH = "in.techware.carrefour.action.CHOOSE_CAUSE_OF_DEATH";

    public static final String INR = "₹";
    public static final String CURRENCY = "₹";

    public static int YEAR_START = 1950;

    public static String MALE = "male";
    public static String FEMALE = "female";

    /* Video Editor Constants*/
    public static final String EXTRA_KEY_VIDEO_SOURCE = "extra_key_video_source";
    public static final String EXTRA_KEY_VIDEO_URI = "extra_key_video_uri";

    /* Image Filter Library Constants*/
    public static final String EXTRA_KEY_IMAGE_SOURCE = "extra_key_image_source";
    public static final String EXTRA_KEY_IMAGE_URI = "extra_key_image_uri";
    public static final String EXTRA_KEY_EFFECT = "e2";

    public static final String KEY_BITMAP = "a1";
    public static final String KEY_URL = "a2";
    public static final String KEY_EFFECTS_LIST = "a3";
    public static final String KEY_SOURCE_ID = "a5";

    public static final int REQUEST_CAMERA = 0;
    public static final int REQUEST_GALLERY = 1;

    public static final int FILE_TRANSFER_RESULT_CONTINUE = 0;
    public static final int FILE_TRANSFER_RESULT_FINISH = 1;
    public static final int FILE_TRANSFER_RESULT_SEND_DATA_COMPLETED = 2;

    public static final int AUTHENTICATION_RESULT_FAILED = 0;
    public static final int AUTHENTICATION_RESULT_SUCCESS = 1;
    public static final int AUTHENTICATION_RESULT_CANCELLED = 2;

    public static final int LABEL_TYPE_INVENTORY_LABEL = 0;
    public static final int LABEL_TYPE_SHELF_LABEL = 1;
    public static final int LABEL_TYPE_IT_LABEL = 2;

    public static final int RESTORE_TYPE_RECEIVING = 0;
    public static final int RESTORE_TYPE_RETURN = 1;
    public static final int RESTORE_TYPE_PRICE_SURVEY = 2;
    public static final int RESTORE_TYPE_STORE_TO_OFFSITE = 3;
    public static final int RESTORE_TYPE_OFFSITE_TO_STORE = 4;

    public static final int ELIE_RESTORE_TYPE_EXPIRY_CAPTURE = 0;
    public static final int ELIE_RESTORE_TYPE_EXPIRED_ACTION = 1;

    public static final String FILE_FOLDER_WORK = "WORK_FILES";
    public static final String FILE_FOLDER_SENT = "SENT_FILES";
    public static final String FILE_FOLDER_RECEIVED = "RECEIVED_FILES";

    public static final String FILE_PATH_AUDIO = "bs";
    public static final String FILE_NAME_USERS = "user";
    public static final String FILE_NAME_ELIE_USER = "elieUser";

    public static final String FTP_SEND_SERVER = "54.251.98.159";
    public static final String FTP_SEND_USERNAME = "ftpCarrefour";
    public static final String FTP_SEND_PASSWORD = "VGVjaGNAcjQ=";
    public static final String FTP_RECEIVE_SERVER = "54.251.98.159";
    public static final String FTP_RECEIVE_USERNAME = "ftpCarrefour";
    public static final String FTP_RECEIVE_PASSWORD = "VGVjaGNAcjQ=";

    public static final String FILE_PREFIX_COMPETITION = "compet";
    public static final String FILE_PREFIX_EXPIRED_ACTION = "expact";
    public static final String FILE_PREFIX_FACING = "facing";
    public static final String FILE_PREFIX_FACING_MIN_STOCK = "lbmk";
    public static final String FILE_PREFIX_FOODBANK = "FoodBank";
    public static final String FILE_PREFIX_INVENTORY_LABEL = "ilabel";
    public static final String FILE_PREFIX_IT_LABEL = "plabel";
    public static final String FILE_PREFIX_ITEM_EXPIRY = "itexpr";
    public static final String FILE_PREFIX_ITEM_LIST = "ilist";
    public static final String FILE_PREFIX_LABEL_SURVEY = "verify";
    public static final String FILE_PREFIX_MINIMUM_STOCK = "stmini";
    public static final String FILE_PREFIX_ORDER = "order";
    public static final String FILE_PREFIX_OUT_OF_STOCK = "outofstk";
    public static final String FILE_PREFIX_PRICE_SURVEY = "pricesurvey";
    public static final String FILE_PREFIX_PRODUCT_INFO_LABEL = "productinfolabel";
    public static final String FILE_PREFIX_PRODUCT_INFO_STOCK = "productinfostock";
    public static final String FILE_PREFIX_PROMOTION = "promotion";
    public static final String FILE_PREFIX_RECEIVING = "recept";
    public static final String FILE_PREFIX_RETURN = "returns";
    public static final String FILE_PREFIX_SHELF_LABEL = "label";
    public static final String FILE_PREFIX_STOCK_TAKE = "stocktake";
    public static final String FILE_PREFIX_TRANS_OFFSITE_TO_STORE = "offsiteout";
    public static final String FILE_PREFIX_TRANS_STOR_TO_OFFSITE = "offsitein";
    public static final String FILE_PREFIX_TRANSFER = "sectrans";
    public static final String FILE_PREFIX_TRANSFER_CORRECTION = "sectransn";
    public static final String FILE_PREFIX_TRANSFORMATION_QTY = "transformqty";
    public static final String FILE_PREFIX_WASTE = "shrink";

    public static final String DataConnMode = "online";
    public static final String ServiceURL = "http://192.168.1.11/ProductInfoService/Service.asmx";
    public static final String ScanFlag = "0";
    public static final String StoreID = "ITMLDTP0003";
    public static final String ITFunctions = "1,2,3,4,5,6,7,8,9,10,11,12,13";
    public static final String ReceiveFunctions = "1,2,3,4,5,6,7";
    public static final String ELIEFunctions = "1,2,3";
    public static final String OrderFunctions = "1,2";
    public static final String MerchandFunctions = "1,2";

    public static String getFileName(MenuBean selectedMenuBean, MenuBean selectedSubMenuBean, int type) {
        String fileName = "";

        switch (selectedMenuBean.getCode()) {
            case HomeMenuUtil.CODE_IT:
                fileName = ITMenuUtil.getFileName(selectedSubMenuBean, type);
                break;
            case HomeMenuUtil.CODE_RECEIVE:
                fileName = ReceiveMenuUtil.getFileName(selectedSubMenuBean, type);
                break;
            case HomeMenuUtil.CODE_ELIE:
                fileName = ELIEMenuUtil.getFileName(selectedSubMenuBean, type);
                break;
            case HomeMenuUtil.CODE_ORDERS:
                fileName = OrderMenuUtil.getFileName(selectedSubMenuBean, type);
                break;
            case HomeMenuUtil.CODE_INFO:
                break;
            case HomeMenuUtil.CODE_MERCHAND:
                fileName = MerchandiseMenuUtil.getFileName(selectedSubMenuBean, type);
                break;
            case HomeMenuUtil.CODE_FOOD_BANK:
                fileName = AppConstants.addWorkFolderPrefix(AppConstants.FILE_PREFIX_FOODBANK);
                break;
            default:
                Toast.makeText(App.getInstance(), "Menu Clicked", Toast.LENGTH_SHORT).show();
                break;
        }


        return fileName;
    }

    public static String addWorkFolderPrefix(String fileName) {
        return AppConstants.FILE_FOLDER_WORK + AppConstants.SEPARATOR
                + fileName;
    }

    public static String addReceivedFolderPrefix(String fileName) {
        return AppConstants.FILE_FOLDER_RECEIVED + AppConstants.SEPARATOR
                + fileName;
    }

    public static String addSentFolderPrefix(String fileName) {
        return AppConstants.FILE_FOLDER_SENT + AppConstants.SEPARATOR
                + fileName;
    }

    private static final String COUNTRY_LIST = "{\"countries\":[{\"name\":\"Afghanistan\",\"dial_code\":\"+93\",\"code\":\"AF\"},{\"name\":\"Aland Islands\",\"dial_code\":\"+358\",\"code\":\"AX\"},{\"name\":\"Albania\",\"dial_code\":\"+355\",\"code\":\"AL\"},{\"name\":\"Algeria\",\"dial_code\":\"+213\",\"code\":\"DZ\"},{\"name\":\"AmericanSamoa\",\"dial_code\":\"+1684\",\"code\":\"AS\"},{\"name\":\"Andorra\",\"dial_code\":\"+376\",\"code\":\"AD\"},{\"name\":\"Angola\",\"dial_code\":\"+244\",\"code\":\"AO\"},{\"name\":\"Anguilla\",\"dial_code\":\"+1264\",\"code\":\"AI\"},{\"name\":\"Antarctica\",\"dial_code\":\"+672\",\"code\":\"AQ\"},{\"name\":\"Antigua and Barbuda\",\"dial_code\":\"+1268\",\"code\":\"AG\"},{\"name\":\"Argentina\",\"dial_code\":\"+54\",\"code\":\"AR\"},{\"name\":\"Armenia\",\"dial_code\":\"+374\",\"code\":\"AM\"},{\"name\":\"Aruba\",\"dial_code\":\"+297\",\"code\":\"AW\"},{\"name\":\"Australia\",\"dial_code\":\"+61\",\"code\":\"AU\"},{\"name\":\"Austria\",\"dial_code\":\"+43\",\"code\":\"AT\"},{\"name\":\"Azerbaijan\",\"dial_code\":\"+994\",\"code\":\"AZ\"},{\"name\":\"Bahamas\",\"dial_code\":\"+1242\",\"code\":\"BS\"},{\"name\":\"Bahrain\",\"dial_code\":\"+973\",\"code\":\"BH\"},{\"name\":\"Bangladesh\",\"dial_code\":\"+880\",\"code\":\"BD\"},{\"name\":\"Barbados\",\"dial_code\":\"+1246\",\"code\":\"BB\"},{\"name\":\"Belarus\",\"dial_code\":\"+375\",\"code\":\"BY\"},{\"name\":\"Belgium\",\"dial_code\":\"+32\",\"code\":\"BE\"},{\"name\":\"Belize\",\"dial_code\":\"+501\",\"code\":\"BZ\"},{\"name\":\"Benin\",\"dial_code\":\"+229\",\"code\":\"BJ\"},{\"name\":\"Bermuda\",\"dial_code\":\"+1441\",\"code\":\"BM\"},{\"name\":\"Bhutan\",\"dial_code\":\"+975\",\"code\":\"BT\"},{\"name\":\"Bolivia, Plurinational State of\",\"dial_code\":\"+591\",\"code\":\"BO\"},{\"name\":\"Bosnia and Herzegovina\",\"dial_code\":\"+387\",\"code\":\"BA\"},{\"name\":\"Botswana\",\"dial_code\":\"+267\",\"code\":\"BW\"},{\"name\":\"Brazil\",\"dial_code\":\"+55\",\"code\":\"BR\"},{\"name\":\"British Indian Ocean Territory\",\"dial_code\":\"+246\",\"code\":\"IO\"},{\"name\":\"Brunei Darussalam\",\"dial_code\":\"+673\",\"code\":\"BN\"},{\"name\":\"Bulgaria\",\"dial_code\":\"+359\",\"code\":\"BG\"},{\"name\":\"Burkina Faso\",\"dial_code\":\"+226\",\"code\":\"BF\"},{\"name\":\"Burundi\",\"dial_code\":\"+257\",\"code\":\"BI\"},{\"name\":\"Cambodia\",\"dial_code\":\"+855\",\"code\":\"KH\"},{\"name\":\"Cameroon\",\"dial_code\":\"+237\",\"code\":\"CM\"},{\"name\":\"Canada\",\"dial_code\":\"+1\",\"code\":\"CA\"},{\"name\":\"Cape Verde\",\"dial_code\":\"+238\",\"code\":\"CV\"},{\"name\":\"Cayman Islands\",\"dial_code\":\"+345\",\"code\":\"KY\"},{\"name\":\"Central African Republic\",\"dial_code\":\"+236\",\"code\":\"CF\"},{\"name\":\"Chad\",\"dial_code\":\"+235\",\"code\":\"TD\"},{\"name\":\"Chile\",\"dial_code\":\"+56\",\"code\":\"CL\"},{\"name\":\"China\",\"dial_code\":\"+86\",\"code\":\"CN\"},{\"name\":\"Christmas Island\",\"dial_code\":\"+61\",\"code\":\"CX\"},{\"name\":\"Cocos (Keeling) Islands\",\"dial_code\":\"+61\",\"code\":\"CC\"},{\"name\":\"Colombia\",\"dial_code\":\"+57\",\"code\":\"CO\"},{\"name\":\"Comoros\",\"dial_code\":\"+269\",\"code\":\"KM\"},{\"name\":\"Congo\",\"dial_code\":\"+242\",\"code\":\"CG\"},{\"name\":\"Congo, The Democratic Republic of the Congo\",\"dial_code\":\"+243\",\"code\":\"CD\"},{\"name\":\"Cook Islands\",\"dial_code\":\"+682\",\"code\":\"CK\"},{\"name\":\"Costa Rica\",\"dial_code\":\"+506\",\"code\":\"CR\"},{\"name\":\"Cote d'Ivoire\",\"dial_code\":\"+225\",\"code\":\"CI\"},{\"name\":\"Croatia\",\"dial_code\":\"+385\",\"code\":\"HR\"},{\"name\":\"Cuba\",\"dial_code\":\"+53\",\"code\":\"CU\"},{\"name\":\"Cyprus\",\"dial_code\":\"+357\",\"code\":\"CY\"},{\"name\":\"Czech Republic\",\"dial_code\":\"+420\",\"code\":\"CZ\"},{\"name\":\"Denmark\",\"dial_code\":\"+45\",\"code\":\"DK\"},{\"name\":\"Djibouti\",\"dial_code\":\"+253\",\"code\":\"DJ\"},{\"name\":\"Dominica\",\"dial_code\":\"+1767\",\"code\":\"DM\"},{\"name\":\"Dominican Republic\",\"dial_code\":\"+1849\",\"code\":\"DO\"},{\"name\":\"Ecuador\",\"dial_code\":\"+593\",\"code\":\"EC\"},{\"name\":\"Egypt\",\"dial_code\":\"+20\",\"code\":\"EG\"},{\"name\":\"El Salvador\",\"dial_code\":\"+503\",\"code\":\"SV\"},{\"name\":\"Equatorial Guinea\",\"dial_code\":\"+240\",\"code\":\"GQ\"},{\"name\":\"Eritrea\",\"dial_code\":\"+291\",\"code\":\"ER\"},{\"name\":\"Estonia\",\"dial_code\":\"+372\",\"code\":\"EE\"},{\"name\":\"Ethiopia\",\"dial_code\":\"+251\",\"code\":\"ET\"},{\"name\":\"Falkland Islands (Malvinas)\",\"dial_code\":\"+500\",\"code\":\"FK\"},{\"name\":\"Faroe Islands\",\"dial_code\":\"+298\",\"code\":\"FO\"},{\"name\":\"Fiji\",\"dial_code\":\"+679\",\"code\":\"FJ\"},{\"name\":\"Finland\",\"dial_code\":\"+358\",\"code\":\"FI\"},{\"name\":\"France\",\"dial_code\":\"+33\",\"code\":\"FR\"},{\"name\":\"French Guiana\",\"dial_code\":\"+594\",\"code\":\"GF\"},{\"name\":\"French Polynesia\",\"dial_code\":\"+689\",\"code\":\"PF\"},{\"name\":\"Gabon\",\"dial_code\":\"+241\",\"code\":\"GA\"},{\"name\":\"Gambia\",\"dial_code\":\"+220\",\"code\":\"GM\"},{\"name\":\"Georgia\",\"dial_code\":\"+995\",\"code\":\"GE\"},{\"name\":\"Germany\",\"dial_code\":\"+49\",\"code\":\"DE\"},{\"name\":\"Ghana\",\"dial_code\":\"+233\",\"code\":\"GH\"},{\"name\":\"Gibraltar\",\"dial_code\":\"+350\",\"code\":\"GI\"},{\"name\":\"Greece\",\"dial_code\":\"+30\",\"code\":\"GR\"},{\"name\":\"Greenland\",\"dial_code\":\"+299\",\"code\":\"GL\"},{\"name\":\"Grenada\",\"dial_code\":\"+1473\",\"code\":\"GD\"},{\"name\":\"Guadeloupe\",\"dial_code\":\"+590\",\"code\":\"GP\"},{\"name\":\"Guam\",\"dial_code\":\"+1671\",\"code\":\"GU\"},{\"name\":\"Guatemala\",\"dial_code\":\"+502\",\"code\":\"GT\"},{\"name\":\"Guernsey\",\"dial_code\":\"+44\",\"code\":\"GG\"},{\"name\":\"Guinea\",\"dial_code\":\"+224\",\"code\":\"GN\"},{\"name\":\"Guinea-Bissau\",\"dial_code\":\"+245\",\"code\":\"GW\"},{\"name\":\"Guyana\",\"dial_code\":\"+595\",\"code\":\"GY\"},{\"name\":\"Haiti\",\"dial_code\":\"+509\",\"code\":\"HT\"},{\"name\":\"Holy See (Vatican City State)\",\"dial_code\":\"+379\",\"code\":\"VA\"},{\"name\":\"Honduras\",\"dial_code\":\"+504\",\"code\":\"HN\"},{\"name\":\"Hong Kong\",\"dial_code\":\"+852\",\"code\":\"HK\"},{\"name\":\"Hungary\",\"dial_code\":\"+36\",\"code\":\"HU\"},{\"name\":\"Iceland\",\"dial_code\":\"+354\",\"code\":\"IS\"},{\"name\":\"India\",\"dial_code\":\"+91\",\"code\":\"IN\"},{\"name\":\"Indonesia\",\"dial_code\":\"+62\",\"code\":\"ID\"},{\"name\":\"Iran, Islamic Republic of Persian Gulf\",\"dial_code\":\"+98\",\"code\":\"IR\"},{\"name\":\"Iraq\",\"dial_code\":\"+964\",\"code\":\"IQ\"},{\"name\":\"Ireland\",\"dial_code\":\"+353\",\"code\":\"IE\"},{\"name\":\"Isle of Man\",\"dial_code\":\"+44\",\"code\":\"IM\"},{\"name\":\"Israel\",\"dial_code\":\"+972\",\"code\":\"IL\"},{\"name\":\"Italy\",\"dial_code\":\"+39\",\"code\":\"IT\"},{\"name\":\"Jamaica\",\"dial_code\":\"+1876\",\"code\":\"JM\"},{\"name\":\"Japan\",\"dial_code\":\"+81\",\"code\":\"JP\"},{\"name\":\"Jersey\",\"dial_code\":\"+44\",\"code\":\"JE\"},{\"name\":\"Jordan\",\"dial_code\":\"+962\",\"code\":\"JO\"},{\"name\":\"Kazakhstan\",\"dial_code\":\"+77\",\"code\":\"KZ\"},{\"name\":\"Kenya\",\"dial_code\":\"+254\",\"code\":\"KE\"},{\"name\":\"Kiribati\",\"dial_code\":\"+686\",\"code\":\"KI\"},{\"name\":\"Korea, Democratic People's Republic of Korea\",\"dial_code\":\"+850\",\"code\":\"KP\"},{\"name\":\"Korea, Republic of South Korea\",\"dial_code\":\"+82\",\"code\":\"KR\"},{\"name\":\"Kuwait\",\"dial_code\":\"+965\",\"code\":\"KW\"},{\"name\":\"Kyrgyzstan\",\"dial_code\":\"+996\",\"code\":\"KG\"},{\"name\":\"Laos\",\"dial_code\":\"+856\",\"code\":\"LA\"},{\"name\":\"Latvia\",\"dial_code\":\"+371\",\"code\":\"LV\"},{\"name\":\"Lebanon\",\"dial_code\":\"+961\",\"code\":\"LB\"},{\"name\":\"Lesotho\",\"dial_code\":\"+266\",\"code\":\"LS\"},{\"name\":\"Liberia\",\"dial_code\":\"+231\",\"code\":\"LR\"},{\"name\":\"Libyan Arab Jamahiriya\",\"dial_code\":\"+218\",\"code\":\"LY\"},{\"name\":\"Liechtenstein\",\"dial_code\":\"+423\",\"code\":\"LI\"},{\"name\":\"Lithuania\",\"dial_code\":\"+370\",\"code\":\"LT\"},{\"name\":\"Luxembourg\",\"dial_code\":\"+352\",\"code\":\"LU\"},{\"name\":\"Macao\",\"dial_code\":\"+853\",\"code\":\"MO\"},{\"name\":\"Macedonia\",\"dial_code\":\"+389\",\"code\":\"MK\"},{\"name\":\"Madagascar\",\"dial_code\":\"+261\",\"code\":\"MG\"},{\"name\":\"Malawi\",\"dial_code\":\"+265\",\"code\":\"MW\"},{\"name\":\"Malaysia\",\"dial_code\":\"+60\",\"code\":\"MY\"},{\"name\":\"Maldives\",\"dial_code\":\"+960\",\"code\":\"MV\"},{\"name\":\"Mali\",\"dial_code\":\"+223\",\"code\":\"ML\"},{\"name\":\"Malta\",\"dial_code\":\"+356\",\"code\":\"MT\"},{\"name\":\"Marshall Islands\",\"dial_code\":\"+692\",\"code\":\"MH\"},{\"name\":\"Martinique\",\"dial_code\":\"+596\",\"code\":\"MQ\"},{\"name\":\"Mauritania\",\"dial_code\":\"+222\",\"code\":\"MR\"},{\"name\":\"Mauritius\",\"dial_code\":\"+230\",\"code\":\"MU\"},{\"name\":\"Mayotte\",\"dial_code\":\"+262\",\"code\":\"YT\"},{\"name\":\"Mexico\",\"dial_code\":\"+52\",\"code\":\"MX\"},{\"name\":\"Micronesia, Federated States of Micronesia\",\"dial_code\":\"+691\",\"code\":\"FM\"},{\"name\":\"Moldova\",\"dial_code\":\"+373\",\"code\":\"MD\"},{\"name\":\"Monaco\",\"dial_code\":\"+377\",\"code\":\"MC\"},{\"name\":\"Mongolia\",\"dial_code\":\"+976\",\"code\":\"MN\"},{\"name\":\"Montenegro\",\"dial_code\":\"+382\",\"code\":\"ME\"},{\"name\":\"Montserrat\",\"dial_code\":\"+1664\",\"code\":\"MS\"},{\"name\":\"Morocco\",\"dial_code\":\"+212\",\"code\":\"MA\"},{\"name\":\"Mozambique\",\"dial_code\":\"+258\",\"code\":\"MZ\"},{\"name\":\"Myanmar\",\"dial_code\":\"+95\",\"code\":\"MM\"},{\"name\":\"Namibia\",\"dial_code\":\"+264\",\"code\":\"NA\"},{\"name\":\"Nauru\",\"dial_code\":\"+674\",\"code\":\"NR\"},{\"name\":\"Nepal\",\"dial_code\":\"+977\",\"code\":\"NP\"},{\"name\":\"Netherlands\",\"dial_code\":\"+31\",\"code\":\"NL\"},{\"name\":\"Netherlands Antilles\",\"dial_code\":\"+599\",\"code\":\"AN\"},{\"name\":\"New Caledonia\",\"dial_code\":\"+687\",\"code\":\"NC\"},{\"name\":\"New Zealand\",\"dial_code\":\"+64\",\"code\":\"NZ\"},{\"name\":\"Nicaragua\",\"dial_code\":\"+505\",\"code\":\"NI\"},{\"name\":\"Niger\",\"dial_code\":\"+227\",\"code\":\"NE\"},{\"name\":\"Nigeria\",\"dial_code\":\"+234\",\"code\":\"NG\"},{\"name\":\"Niue\",\"dial_code\":\"+683\",\"code\":\"NU\"},{\"name\":\"Norfolk Island\",\"dial_code\":\"+672\",\"code\":\"NF\"},{\"name\":\"Northern Mariana Islands\",\"dial_code\":\"+1670\",\"code\":\"MP\"},{\"name\":\"Norway\",\"dial_code\":\"+47\",\"code\":\"NO\"},{\"name\":\"Oman\",\"dial_code\":\"+968\",\"code\":\"OM\"},{\"name\":\"Pakistan\",\"dial_code\":\"+92\",\"code\":\"PK\"},{\"name\":\"Palau\",\"dial_code\":\"+680\",\"code\":\"PW\"},{\"name\":\"Palestinian Territory, Occupied\",\"dial_code\":\"+970\",\"code\":\"PS\"},{\"name\":\"Panama\",\"dial_code\":\"+507\",\"code\":\"PA\"},{\"name\":\"Papua New Guinea\",\"dial_code\":\"+675\",\"code\":\"PG\"},{\"name\":\"Paraguay\",\"dial_code\":\"+595\",\"code\":\"PY\"},{\"name\":\"Peru\",\"dial_code\":\"+51\",\"code\":\"PE\"},{\"name\":\"Philippines\",\"dial_code\":\"+63\",\"code\":\"PH\"},{\"name\":\"Pitcairn\",\"dial_code\":\"+872\",\"code\":\"PN\"},{\"name\":\"Poland\",\"dial_code\":\"+48\",\"code\":\"PL\"},{\"name\":\"Portugal\",\"dial_code\":\"+351\",\"code\":\"PT\"},{\"name\":\"Puerto Rico\",\"dial_code\":\"+1939\",\"code\":\"PR\"},{\"name\":\"Qatar\",\"dial_code\":\"+974\",\"code\":\"QA\"},{\"name\":\"Romania\",\"dial_code\":\"+40\",\"code\":\"RO\"},{\"name\":\"Russia\",\"dial_code\":\"+7\",\"code\":\"RU\"},{\"name\":\"Rwanda\",\"dial_code\":\"+250\",\"code\":\"RW\"},{\"name\":\"Reunion\",\"dial_code\":\"+262\",\"code\":\"RE\"},{\"name\":\"Saint Barthelemy\",\"dial_code\":\"+590\",\"code\":\"BL\"},{\"name\":\"Saint Helena, Ascension and Tristan Da Cunha\",\"dial_code\":\"+290\",\"code\":\"SH\"},{\"name\":\"Saint Kitts and Nevis\",\"dial_code\":\"+1869\",\"code\":\"KN\"},{\"name\":\"Saint Lucia\",\"dial_code\":\"+1758\",\"code\":\"LC\"},{\"name\":\"Saint Martin\",\"dial_code\":\"+590\",\"code\":\"MF\"},{\"name\":\"Saint Pierre and Miquelon\",\"dial_code\":\"+508\",\"code\":\"PM\"},{\"name\":\"Saint Vincent and the Grenadines\",\"dial_code\":\"+1784\",\"code\":\"VC\"},{\"name\":\"Samoa\",\"dial_code\":\"+685\",\"code\":\"WS\"},{\"name\":\"San Marino\",\"dial_code\":\"+378\",\"code\":\"SM\"},{\"name\":\"Sao Tome and Principe\",\"dial_code\":\"+239\",\"code\":\"ST\"},{\"name\":\"Saudi Arabia\",\"dial_code\":\"+966\",\"code\":\"SA\"},{\"name\":\"Senegal\",\"dial_code\":\"+221\",\"code\":\"SN\"},{\"name\":\"Serbia\",\"dial_code\":\"+381\",\"code\":\"RS\"},{\"name\":\"Seychelles\",\"dial_code\":\"+248\",\"code\":\"SC\"},{\"name\":\"Sierra Leone\",\"dial_code\":\"+232\",\"code\":\"SL\"},{\"name\":\"Singapore\",\"dial_code\":\"+65\",\"code\":\"SG\"},{\"name\":\"Slovakia\",\"dial_code\":\"+421\",\"code\":\"SK\"},{\"name\":\"Slovenia\",\"dial_code\":\"+386\",\"code\":\"SI\"},{\"name\":\"Solomon Islands\",\"dial_code\":\"+677\",\"code\":\"SB\"},{\"name\":\"Somalia\",\"dial_code\":\"+252\",\"code\":\"SO\"},{\"name\":\"South Africa\",\"dial_code\":\"+27\",\"code\":\"ZA\"},{\"name\":\"South Sudan\",\"dial_code\":\"+211\",\"code\":\"SS\"},{\"name\":\"South Georgia and the South Sandwich Islands\",\"dial_code\":\"+500\",\"code\":\"GS\"},{\"name\":\"Spain\",\"dial_code\":\"+34\",\"code\":\"ES\"},{\"name\":\"Sri Lanka\",\"dial_code\":\"+94\",\"code\":\"LK\"},{\"name\":\"Sudan\",\"dial_code\":\"+249\",\"code\":\"SD\"},{\"name\":\"Suriname\",\"dial_code\":\"+597\",\"code\":\"SR\"},{\"name\":\"Svalbard and Jan Mayen\",\"dial_code\":\"+47\",\"code\":\"SJ\"},{\"name\":\"Swaziland\",\"dial_code\":\"+268\",\"code\":\"SZ\"},{\"name\":\"Sweden\",\"dial_code\":\"+46\",\"code\":\"SE\"},{\"name\":\"Switzerland\",\"dial_code\":\"+41\",\"code\":\"CH\"},{\"name\":\"Syrian Arab Republic\",\"dial_code\":\"+963\",\"code\":\"SY\"},{\"name\":\"Taiwan\",\"dial_code\":\"+886\",\"code\":\"TW\"},{\"name\":\"Tajikistan\",\"dial_code\":\"+992\",\"code\":\"TJ\"},{\"name\":\"Tanzania, United Republic of Tanzania\",\"dial_code\":\"+255\",\"code\":\"TZ\"},{\"name\":\"Thailand\",\"dial_code\":\"+66\",\"code\":\"TH\"},{\"name\":\"Timor-Leste\",\"dial_code\":\"+670\",\"code\":\"TL\"},{\"name\":\"Togo\",\"dial_code\":\"+228\",\"code\":\"TG\"},{\"name\":\"Tokelau\",\"dial_code\":\"+690\",\"code\":\"TK\"},{\"name\":\"Tonga\",\"dial_code\":\"+676\",\"code\":\"TO\"},{\"name\":\"Trinidad and Tobago\",\"dial_code\":\"+1868\",\"code\":\"TT\"},{\"name\":\"Tunisia\",\"dial_code\":\"+216\",\"code\":\"TN\"},{\"name\":\"Turkey\",\"dial_code\":\"+90\",\"code\":\"TR\"},{\"name\":\"Turkmenistan\",\"dial_code\":\"+993\",\"code\":\"TM\"},{\"name\":\"Turks and Caicos Islands\",\"dial_code\":\"+1649\",\"code\":\"TC\"},{\"name\":\"Tuvalu\",\"dial_code\":\"+688\",\"code\":\"TV\"},{\"name\":\"Uganda\",\"dial_code\":\"+256\",\"code\":\"UG\"},{\"name\":\"Ukraine\",\"dial_code\":\"+380\",\"code\":\"UA\"},{\"name\":\"United Arab Emirates\",\"dial_code\":\"+971\",\"code\":\"AE\"},{\"name\":\"United Kingdom\",\"dial_code\":\"+44\",\"code\":\"GB\"},{\"name\":\"United States\",\"dial_code\":\"+1\",\"code\":\"US\"},{\"name\":\"Uruguay\",\"dial_code\":\"+598\",\"code\":\"UY\"},{\"name\":\"Uzbekistan\",\"dial_code\":\"+998\",\"code\":\"UZ\"},{\"name\":\"Vanuatu\",\"dial_code\":\"+678\",\"code\":\"VU\"},{\"name\":\"Venezuela, Bolivarian Republic of Venezuela\",\"dial_code\":\"+58\",\"code\":\"VE\"},{\"name\":\"Vietnam\",\"dial_code\":\"+84\",\"code\":\"VN\"},{\"name\":\"Virgin Islands, British\",\"dial_code\":\"+1284\",\"code\":\"VG\"},{\"name\":\"Virgin Islands, U.S.\",\"dial_code\":\"+1340\",\"code\":\"VI\"},{\"name\":\"Wallis and Futuna\",\"dial_code\":\"+681\",\"code\":\"WF\"},{\"name\":\"Yemen\",\"dial_code\":\"+967\",\"code\":\"YE\"},{\"name\":\"Zambia\",\"dial_code\":\"+260\",\"code\":\"ZM\"},{\"name\":\"Zimbabwe\",\"dial_code\":\"+263\",\"code\":\"ZW\"}]}";


    private static final String LANGUAGE_LIST = "{\"languages\":[{\"id\":0,\"name\":\"English\",\"shortCode\":\"en\",\"status\":1},{\"id\":1,\"name\":\"Arabic\",\"shortCode\":\"ar\",\"status\":1},{\"id\":2,\"name\":\"Urdu\",\"shortCode\":\"ur\",\"status\":1},{\"id\":3,\"name\":\"François (French)\",\"shortCode\":\"fr\",\"status\":1},{\"id\":4,\"name\":\"Chinese\",\"shortCode\":\"zh\",\"status\":1},{\"id\":5,\"name\":\"Deustsch (German)\",\"shortCode\":\"de\",\"status\":1},{\"id\":6,\"name\":\"Japanese\",\"shortCode\":\"jp\",\"status\":1},{\"id\":7,\"name\":\"Portuguese\",\"shortCode\":\"pt\",\"status\":1},{\"id\":8,\"name\":\"Korean\",\"shortCode\":\"ko\",\"status\":1},{\"id\":9,\"name\":\"Turkish\",\"shortCode\":\"tr\",\"status\":1},{\"id\":10,\"name\":\"Farsi (Persian)\",\"shortCode\":\"fa\",\"status\":1},{\"id\":11,\"name\":\"Romanian\",\"shortCode\":\"ro\",\"status\":1}]}";

    public static CountryListBean getCountryListBean() {

        CountryListBean countryListBean = new Gson().fromJson(COUNTRY_LIST, CountryListBean.class);
        for (int i = 0; i < countryListBean.getCountries().size(); i++) {
            countryListBean.getCountries().get(i).setId(String.valueOf(i));
        }
        return countryListBean;

    }

    public static CountryBean getCountryBean(int type, String value) {
        for (CountryBean bean : getCountryListBean().getCountries()) {
            switch (type) {
                case COUNTRY_TYPE_ID:
                    if (String.valueOf(bean.getId()).equals(value)) {
                        return bean;
                    }
                case COUNTRY_TYPE_DIALCODE:
                    if (bean.getDialCode().equals(value)) {
                        return bean;
                    }
                case COUNTRY_TYPE_NAME:
                    if (bean.getName().equals(value)) {
                        return bean;
                    }
                case COUNTRY_TYPE_COUNTRY_CODE:
                    if (bean.getCountryCode().equals(value)) {
                        return bean;
                    }
                default:
                    if (bean.getName().equals(value)) {
                        return bean;
                    }
            }
        }
        return null;
    }
}
