import { getDomainSuffix, isDebugEnv } from "@utils/helpers";
import areaApi from "@db/areaApi";

export const REQ_STATUS = {
    NONE: "NONE",
    LOADING: "LOADING",
    IDLE: "IDLE",
    FAILED: "FAILED"
};

export const API_URL_MAIN = "https://api.uswinslots.com";
export const WS_URL_MAIN = "wss://api.uswinslots.com:10000";
export const API_URL_TEST = "https://testapi.usgamewin.com/";
export const WS_URL_TEST = "wss://testapi.usgamewin.com:10000";
const getAreaApi = () => {
    // let areaID=global.getLocalAreaID();
    // for (let i = 0; i < areaApi.length; i++) {
    //     let apiItem=areaApi[i];
    //     if (apiItem.areaID === areaID){
    //         return apiItem.api;
    //     }
    // }
    // return "https://testapi.usgamewin.com/";
    return getApiUrl();
};

export const getApiUrl = () => {
    //return API_URL_MAIN;
    if (window.Capacitor?.isNativePlatform?.()) {
        console.log("getApiUrl:", window.AndroidAdjust?.isTest?.())
        return window.AndroidAdjust?.isTest?.() ? API_URL_TEST : API_URL_MAIN;
    } else {
        return isDebugEnv() ? API_URL_TEST : API_URL_MAIN;
    }
};

export const getWsUrl = () => {
    //return WS_URL_MAIN;
    if (window.Capacitor?.isNativePlatform?.()) {
        console.log("getWsUrl:", window.AndroidAdjust?.isTest?.())
        return window.AndroidAdjust?.isTest?.() ? WS_URL_TEST : WS_URL_MAIN;
    } else {
        return isDebugEnv() ? WS_URL_TEST : WS_URL_MAIN;
    }
};

// export const BASE_API="https://api.24680.com/";
// export const BASE_API=getDomainSuffix()==="pro"?"https://test.24b.pro/":"https://br.24b.pro/";
export const BASE_API = getApiUrl();

export const BASE_WS = getWsUrl();

export const BASE_PREFIX = "game/";

// export const APP_AVATAR="https://cdn.moeda777.com/24680/assets/avatar/1/";
export const APP_AVATAR = "https://24680.imgix.net/24680/assets/avatar/2/";

export const APP_IMGIX_URL = "https://24680.imgix.net/24680/assets/";
//路由
export const APP_ROUTES = BASE_PREFIX + "routes";
//page 模块
export const APP_PAGE_MODULES = BASE_PREFIX + "pageModules";
//game more
export const APP_GAME_LIST = BASE_PREFIX + "gameList";
//login
export const APP_LOGIN = BASE_PREFIX + "login";
//Reg
export const APP_REGISTER = BASE_PREFIX + "register";
export const APP_REGISTER_NEW = BASE_PREFIX + "registerNew";
//RegGold
export const APP_REGISTERGOLD = BASE_PREFIX + "getRegisterGold";
//logout
export const APP_LOGOUT = BASE_PREFIX + "logout";
//changePass
export const APP_CHANGE_PASS = BASE_PREFIX + "changePass";
//forgetPass
export const APP_FORGET_PASS = BASE_PREFIX + "forgetPass";
//changeInfo
export const APP_CHANGE_INFO = BASE_PREFIX + "changeInfo";
//增加/game/changePhone /game/changeEmail
export const APP_CHANGE_PHONE = BASE_PREFIX + "changePhone";
export const APP_CHANGE_EMAIL = BASE_PREFIX + "changeEmail";
//pay
export const APP_RECHARGE_CONFIG = BASE_PREFIX + "recharge/gear";
export const APP_FIRSTPAY_CONFIG = BASE_PREFIX + "recharge/firstPayConfig";
export const APP_ACCOUNTS_PAY_INFO = BASE_PREFIX + "api/get_accounts_pay_info";
export const APP_PAYMENT_ORDER = BASE_PREFIX + "payment_entry/pay";
export const APP_PAY_ORDER_LIST = BASE_PREFIX + "pay/orderList";
export const APP_PAYMENT_ORDER_QR = BASE_PREFIX + "payment_entry/payqr";
export const APP_FIRST_PAY_MULTI = BASE_PREFIX + "pay/first_pay_multi";
export const APP_GET_SECOND = BASE_PREFIX + "pay/get_second";
export const APP_PAY_KYC_EU = BASE_PREFIX + "kyc/eu";
//首充礼包
export const APP_FIRST_PAY_GIFT = BASE_PREFIX + "pay/first_pay_gift";
export const APP_FIRST_PAY_GIFT_CLAIM = BASE_PREFIX + "pay/claim_first_pay_gift";
///破产礼包
export const APP_BANKRUPTCY_GIFT = BASE_PREFIX + "pay/bankruptcy_gift";
//pay
//withdraw
export const APP_WITHDRAW_TAX = "api/api/withDrawTax";
export const APP_WITHDRAW_BASE_INFO = BASE_PREFIX + "withDraw/baseInfo";
export const APP_WITHDRAW_INFO = BASE_PREFIX + "withDraw/getWithDrawInfo";
export const APP_CHANGE_PAY_PASS = BASE_PREFIX + "changePayPass";
export const APP_WITHDRAW_RECORD = BASE_PREFIX + "withDraw/record";
export const APP_WITHDRAW_SET_INFO = BASE_PREFIX + "withDraw/withDrawInfo";
export const APP_WITHDRAW_PAYOUT = BASE_PREFIX + "withDraw/payout";
export const APP_FORGET_PAY_PASS = BASE_PREFIX + "forgetPayPass";
export const APP_MEX_WITHDRAW_SET_INFO = BASE_PREFIX + "withDraw/mexWithDrawInfo";
export const APP_RU_WITHDRAW_SET_INFO = BASE_PREFIX + "withDraw/ruWithDrawInfo";
//withdraw
//userinfo
export const APP_GAME_INFO = BASE_PREFIX + "info";
//custom customer_service
export const APP_CUSTOMER_SERVICE = BASE_PREFIX + "service";
export const APP_CUSTOMER_LEAVEMSG = BASE_PREFIX + "user/message";
// /game/turnplate/index
// /game/turnplate/kan
// /game/turnplate/bonus
//turnplate
export const APP_TURNPLATE_INDEX = BASE_PREFIX + "turnplate/index";
export const APP_TURNPLATE_KAN = BASE_PREFIX + "turnplate/kan";
export const APP_TURNPLATE_BONUS = BASE_PREFIX + "turnplate/bonus";
//帮别人砍
export const APP_TURNPLATE_HELP = BASE_PREFIX + "turnplate/help";
//mail
// game/mail/list
// game/mail/check
// /game/mail/read
// /game/mail/del
// /game/mail/take
export const APP_MAIL_LIST = BASE_PREFIX + "mail/list";
export const APP_MAIL_CHECK = BASE_PREFIX + "mail/check";
export const APP_MAIL_READ = BASE_PREFIX + "mail/read";
export const APP_MAIL_DEL = BASE_PREFIX + "mail/del";
export const APP_MAIL_TAKE = BASE_PREFIX + "mail/take";
// /game/redpack/check
// /game/redpack/receive
export const APP_REDPACK_CHECK = BASE_PREFIX + "redpack/check";
export const APP_REDPACK_RECEIVE = BASE_PREFIX + "redpack/receive";
export const APP_REDPACK_CONFIG = BASE_PREFIX + "redpack/config";
//agent
export const APP_AGENT_CHECK = BASE_PREFIX + "agent/check";
export const APP_AGENT_GET = BASE_PREFIX + "agent/get";
export const APP_AGENT_HISTORY = BASE_PREFIX + "agent/history";
//activity
export const APP_GAME_ACTIVITY = BASE_PREFIX + "actList";
//checkin
export const APP_CHECKIN_CHECK = BASE_PREFIX + "checkin/check";
export const APP_CHECKIN_GET = BASE_PREFIX + "checkin/get";
//favo
export const APP_FAVO_ADD = BASE_PREFIX + "favo/add";
export const APP_FAVO_REMOVE = BASE_PREFIX + "favo/remove";
export const APP_FAVO_GET = BASE_PREFIX + "favo/get";
//gameInfo
export const APP_GAME_CARD_INFO = BASE_PREFIX + "gameinfo";
//otp
export const APP_SEND_CODE = BASE_PREFIX + "send_code";
//bind sms
export const APP_BIND_SMS = BASE_PREFIX + "bindsms";
//smslogin
export const APP_SMS_LOGIN = BASE_PREFIX + "smslogin";
//apk
export const APP_GAME_APK = BASE_PREFIX + "apk";
//protect
export const APP_PROTECT_CHECK = BASE_PREFIX + "protect/check";
export const APP_PROTECT_GET = BASE_PREFIX + "protect/get";

//apk load
export const APP_APK_LOADNEW = BASE_PREFIX + "apk/loadnew";

//save cpf
export const APP_SAVE_CPF = BASE_PREFIX + "withDraw/savecpf";


// free withdraw
export const APP_FREE_WITHDRAW = BASE_PREFIX + "withDraw/freeWithDrawInfo";

// free withdraw mission
export const APP_FREE_WITHDRAW_MISSION = BASE_PREFIX + "vip-withdraw/tasks";
export const APP_FREE_WITHDRAW_CLAIM = BASE_PREFIX + "vip-withdraw/claim";

export const APP_TEST_CHANGE = BASE_PREFIX + "test_change";

export const APP_HOLIDAYS_GIFT_INFO = BASE_PREFIX + "holiday_wheel/info";
export const APP_HOLIDAYS_GIFT_SPIN = BASE_PREFIX + "holiday_wheel/spin";

export const APP_HOLIDAYS_ACT_INFO = BASE_PREFIX + "christmas_wheel/info";
export const APP_HOLIDAYS_ACT_SPIN = BASE_PREFIX + "christmas_wheel/spin";

export const APP_GET_PWA_BONUS = BASE_PREFIX + "getPwaBonus";
