import mockUrls from './apiUrlMocks'
import mockedUrlStatus from '@/../mock-api-url'

export const API_URL_V1 = process.env.VUE_APP_BACKEND_URL + '/v1'
export const API_URL_V2 = process.env.VUE_APP_BACKEND_URL + '/v2'
export const API_MOCK = process.env.VUE_APP_BACKEND_MOCK === 'true'

export const api_mocker = function(url) {
  if (API_MOCK === true || mockedUrlStatus[url] === true) {
    if (mockUrls[url] !== undefined) {
      return mockUrls[url]
    }
  }

  return url
}

// GENERAL ============================================================================================================
export const API_LOGIN_URL = api_mocker(API_URL_V1 + '/login')
export const API_EMAIL_PASSWORD_URL = api_mocker(API_URL_V1 + '/password/email')
export const API_RESET_PASSWORD_URL = api_mocker(API_URL_V1 + '/password/reset')
export const API_USER_URL = api_mocker(API_URL_V1 + '/user')
export const API_USER_CHANGE_PASSWORD_URL = api_mocker(API_USER_URL + '/change-password')
export const API_COUNTRY_RELATION = api_mocker(API_URL_V1 + '/country/relation')
export const API_COUNTRIES_LIST_URL = api_mocker(API_URL_V1 + '/countries-list')
export const API_COUNTRIES_URL = api_mocker(API_URL_V1 + '/countries')
export const API_CITIES_URL = api_mocker(API_URL_V1 + '/cities')
export const API_COUNTRY_DYNAMIC_CONTENT_TYPES = api_mocker(API_URL_V1 + '/country-dynamic-content/types')
export const API_UPLOAD_SETTINGS = api_mocker(API_URL_V1 + '/file-upload-setting')
export const API_UPLOAD = api_mocker(API_URL_V1 + '/file-upload-process')
export const API_MEMBER_PLACEMENT_VERIFY = api_mocker(API_URL_V1 + '/member-placement-verify')
export const API_GUEST_LOGIN = api_mocker(API_URL_V1 + '/guest')
export const API_POST_ENROLMENT = api_mocker(API_URL_V1 + '/enrollment')
export const API_GET_ENROLMENT = api_mocker(API_URL_V1 + '/enrollment-temp-data')
export const API_GET_ENROLMENT_TAIWAN_FILES = api_mocker(API_URL_V1 + '/enrollment-taiwan-files')
export const MASTER_KEY_URL = api_mocker(API_URL_V1 + '/master/keys')
export const SMART_LIBRARY_EFORM_LIST = api_mocker(API_URL_V1 + '/smart-library/e-form/list')
export const SETTINGS_URL = api_mocker(API_URL_V1 + '/settings')
export const API_GET_HIERARCHICAL_CONFIG = api_mocker(API_URL_V1 + '/hierarchical-config')

// MEMBER ==============================================================================================================
export const MEMBER_RANKS_LIST = api_mocker(API_URL_V1 + '/enrollment-ranks-list')
export const MEMBER_DETAILS = api_mocker(API_URL_V1 + '/member-details')
export const MEMBER_PUT = api_mocker(API_URL_V1 + '/member')
export const MEMBER_DASHBOARD = api_mocker(API_URL_V1 + '/member-dashboard')
export const MEMBER_EMAIL_VALIDATE = api_mocker(API_URL_V1 + '/member-email-validate')
export const MEMBER_TREE_NETWORK_VERIFY = api_mocker(API_URL_V1 + '/same-member-tree-network-verify')
export const MEMBER_SPONSOR_SEARCH = api_mocker(API_URL_V1 + '/member-sponsor-search')
export const MEMBER_DASHBOARD_MENTOR_BONUS_DETAIL = api_mocker(API_URL_V1 + '/member-dashboard/mentor-bonus-detail')
export const MEMBER_DASHBOARD_TEAM_BONUS_DETAIL = api_mocker(API_URL_V1 + '/member-dashboard/team-bonus-detail')
export const MEMBER_DASHBOARD_WELCOME_BONUS_DETAIL = api_mocker(API_URL_V1 + '/member-dashboard/welcome-bonus-detail')
export const MEMBER_DASHBOARD_BA_INACTIVE_DETAIL = api_mocker(API_URL_V1 + '/member-dashboard/ba-inactive-detail')
export const MEMBER_AMP_PREFERENCE_DETAIL = api_mocker(API_URL_V1 + '/member-amp-preference')
export const MEMBER_AMP_PREFERENCE_DETAIL_UPDATE = api_mocker(API_URL_V1 + '/member-amp-preference')
export const MEMBER_AMP_PREFERENCE_LOG = api_mocker(API_URL_V1 + '/member-amp-preference-history')
export const MEMBER_SPONSOR_SEARCH_WITH_REFERENCE = api_mocker(API_URL_V1 + '/product-sponsor')
export const MEMBER_BONUS_MANUAL_ADJUSTMENT = api_mocker(API_URL_V1 + '/member-bonus-manual-adjustment')
export const MEMBER_BV_SV_STATEMENT = api_mocker(API_URL_V1 + '/member/sv-bv-report')
export const MEMBER_COUNCIL_RANK_LIST = api_mocker(API_URL_V1 + '/council/council-rank')
export const MEMBER_SPONSOR_DOWNLINE_LISTING = api_mocker(API_URL_V1 + '/sponsor-listing')
export const MEMBER_SPONSOR_DOWNLINE_FILTERS = api_mocker(API_URL_V1 + '/sponsor-listing-filters')
export const MEMBER_SPONSOR_DOWNLINE_REPORT = api_mocker(API_URL_V1 + '/sponsor-listing-report')

// E-Shop ==============================================================================================================
export const ESHOP_PRODUCT_DETAILS = api_mocker(API_URL_V1 + '/product-details')
export const ESHOP_KITTING_DETAILS = api_mocker(API_URL_V1 + '/kitting-details')
export const ESHOP_PRODUCT_GET_PRODUCT_CATEGORIES = api_mocker(API_URL_V1 + '/shop/categories')
export const ESHOP_PRODUCT_GET_PRODUCTS = api_mocker(API_URL_V1 + '/shop/product-and-kitting')
export const ESHOP_CART_ADD_PRODUCT = api_mocker(API_URL_V1 + '/shop/cart')
export const ESHOP_CART_DETAILS = api_mocker(API_URL_V1 + '/shop/cart-details')
export const ESHOP_CW_INFO = api_mocker(API_URL_V1 + '/shop/cw-info')
export const ESHOP_CART_CLEAR = api_mocker(API_URL_V1 + '/shop/cart-clear')
export const ESHOP_CART_ELIGIBLE_PROMO = api_mocker(API_URL_V1 + '/shop/cart-eligible-promo')
export const ESHOP_CBP_BREAKDOWN = api_mocker(API_URL_V1 + '/shop/cbp-breakdown/')
export const ESHOP_SEARCH_RECOMMENDATION = api_mocker(API_URL_V1 + '/products-search-recommendation')

// Sales ===============================================================================================================
export const SALES_PAYMENT_MODES = api_mocker(API_URL_V1 + '/payments/sales')
export const SALES_PAYMENT_MAKE_PAYMENT = api_mocker(API_URL_V1 + '/payments/payment-make')
export const SALES_PAYMENT_CROSS_DOMAIN_MAKE_PAYMENT = api_mocker(API_URL_V1 + '/payments/post-payment')
export const SALES_PAYMENT_CROSS_DOMAIN_REDIRECT = api_mocker(API_URL_V1 + '/payments/redirect')
export const SALES_PAYMENT_CHECK_STATUS = api_mocker(API_URL_V1 + '/payments/status')
export const SALES_SHOP_CREATE_SALES = api_mocker(API_URL_V1 + '/shop/create-sale')
export const SALES_CART_CREATE_SALES = api_mocker(API_URL_V1 + '/shop/create-cart-sale')
export const SALES_SUBSCRIPTION = api_mocker(API_URL_V1 + '/sales/create-member-subscription')
export const EVOUCHER_GET_BY_SALE = api_mocker(API_URL_V1 + '/evoucher/get-by-sale')
export const EVOUCHER_ACTIVATION = api_mocker(API_URL_V1 + '/evoucher/activate')
export const EVOUCHER_REDEEM = api_mocker(API_URL_V1 + '/evoucher/redeem')
export const EVOUCHER_RECEIPT = api_mocker(API_URL_V1 + '/evoucher/download-receipt')
export const PAYMENT_QRCODE = api_mocker(API_URL_V1 + '/qrcode/payment')
export const RESUME_PAYMENT = api_mocker(API_URL_V1 + '/sales/resume-payment')

// E-Wallet ============================================================================================================
// TODO : FOLLOW NAMING STANDARDS {DONE}
export const EWALLET_HOME = api_mocker(API_URL_V1 + '/ewallet')
export const EWALLET_TRANSACTIONS = api_mocker(EWALLET_HOME + '/transactions')
export const EWALLET_TRANSACTIONS_DETAILS = api_mocker(EWALLET_HOME + '/transaction/')
export const EWALLET_NEW_TRANSACTION = api_mocker(EWALLET_HOME + '/new-transaction')
export const EWALLET_MOBILE_VALIDATION = api_mocker(EWALLET_HOME + '/validate-mobile')
export const EWALLET_MOBILE_ACTIVATION = api_mocker(EWALLET_HOME + '/activate-ewallet')
export const EWALLET_FORGOT_SECURITY_PIN = api_mocker(EWALLET_HOME + '/forgot-security-pin')
export const EWALLET_CHANGE_AUTOWITHDRAWAL_TYPE = api_mocker(EWALLET_HOME + '/change-autowithdrawal')
export const EWALLET_VALIDATE_SECURITY_PIN = api_mocker(EWALLET_HOME + '/validate-security-pin')
export const EWALLET_CANCEL_FUND_WITHDRAWAL = api_mocker(EWALLET_HOME + '/cancel-manual-withdrawal')

// AUTOSHIP ============================================================================================================
export const AUTOSHIP_CREATE_CARD = API_URL_V1 + '/autoship-card'
export const AUTOSHIP_GET_CARD_LIST = API_URL_V1 + '/autoship-card'
export const AUTOSHIP_CREATE_SALES = API_URL_V1 + '/shop/create-cart-subscription'
export const AUTOSHIP_GET_SUBSCRIPTION = API_URL_V1 + '/autoship-subscription'
export const AUTOSHIP_UPDATE_SUBSCRIPTION = API_URL_V1 + '/autoship-subscription/'
export const AUTOSHIP_TERMINATE_SUBSCRIPTION = API_URL_V1 + '/autoship-subscription'

// TODO: ORGANIZE
export const LANGUAGES_URL = api_mocker(API_URL_V1 + '/languages')
export const LANGUAGES_LIST_URL = api_mocker(API_URL_V1 + '/languages-list')
export const STATES_LIST_URL = api_mocker(API_URL_V1 + '/states')
export const API_GET_ESAC_VOUCHER_LIST_URL = api_mocker(API_URL_V1 + '/esac-voucher-list')
export const API_GET_ESAC_PRODUCT_CATEGORY_LIST_URL = api_mocker(API_URL_V1 + '/product-categories-list')
export const API_GET_ESAC_PRODUCT_LIST_URL = api_mocker(API_URL_V1 + '/sales/search-product-kitting')
export const API_SPONSOR_DOWNLINE_LISTING_URL = api_mocker(API_URL_V1 + '/sponsor-downline-listing')
export const API_SPONSOR_NETWORK_TREE_URL = api_mocker(API_URL_V1 + '/member-tree')
export const API_PLACEMENT_NETWORK_PERFORMANCE_URL = api_mocker(API_URL_V1 + '/placement-network-performance')
export const API_GENEALOGY_MEMBER_PLACEMENT_TREE = api_mocker(API_URL_V1 + '/member-placement-tree')
export const API_GENEALOGY_MEMBER_PLACEMENT_TREE_OUTER = api_mocker(API_URL_V1 + '/member-placement-tree-outer')
export const API_GET_GENEALOGY_MEMBER_LIST_URL = api_mocker(API_URL_V1 + '/member-list')
export const API_GET_CW_SCHEDULES_LIST_URL = api_mocker(API_URL_V1 + '/cw-schedules-list')
export const API_GET_ACTIVE_COUNTRY_URL = api_mocker(API_URL_V1 + '/countries-list')
export const API_GET_STATE_LIST = api_mocker(API_URL_V1 + '/states-list')
export const API_GET_ADDRESS_FORMAT_URL = api_mocker(API_URL_V1 + '/country-dynamic-content/types')
export const API_GET_ESAC_STATE_CITY_URL = api_mocker(API_URL_V1 + '/states-list')
export const API_GET_LOCATION_ADDRESS_LIST_URL = api_mocker(API_URL_V1 + '/locations-addresses-list')
export const API_GET_STOCK_LOCATION_BY_TRANSACTION_LOCATION = api_mocker(API_URL_V1 + '/stock-locations')
export const API_GET_ESAC_SALE_CREATION_DATA_URL = api_mocker(API_URL_V1 + '/sales/sales-product-eligible')
export const API_CREATE_ESAC_REDEMPTION_URL = api_mocker(API_URL_V1 + '/sales')
export const API_GET_ESAC_SALE_DETAIL_URL = api_mocker(API_URL_V1 + '/sales-details')
export const API_GET_PAYMENT_MODE_SETTING_URL = api_mocker(API_URL_V1 + '/payments/sales')
export const PAYMENT_DOCUMENT_DETAILS = api_mocker(API_URL_V1 + '/payment-document-details')
export const API_DOWNLOAD_INVOICE_URL = api_mocker(API_URL_V1 + '/invoice/downloadpdf')
export const SALES_LIST = api_mocker(API_URL_V1 + '/sales-list')
export const SALES_DETAILS = api_mocker(API_URL_V1 + '/sales-details')
export const SALES_CREDIT_NOTE_DOWNLOAD_PDF = api_mocker(API_URL_V1 + '/sales/creditnote/downloadpdf')
export const LOCATIONS_TYPE_LIST = api_mocker(API_URL_V1 + '/locations-types-list')

// TODO: ORGANIZE
export const CAMPAIGN_LIST_URL = api_mocker(API_URL_V1 + '/campaign-list')
export const CW_SCHEDULES_LIST_URL = api_mocker(API_URL_V1 + '/cw-schedules-list')
export const GET_MEMBER_LIST = api_mocker(API_URL_V1 + '/member-list')
export const GET_MEMBER_DETAILS = api_mocker(API_URL_V1 + '/member-details')
export const GET_MEMBER_CAMPAIGN_REPORT = api_mocker(API_URL_V1 + '/member-campaign-report')

export const BONUS_RANKS_LIST = api_mocker(API_URL_V1 + '/team-bonus-ranks-list')
export const WEEKLY_BONUS_STATEMENT_URL = api_mocker(API_URL_V1 + '/bonus-statement')
export const ANNUAL_INCOME_STATEMENT_URL = api_mocker(API_URL_V1 + '/yearly-income-report')
export const WELCOME_BONUS_DAILY_URL = api_mocker(API_URL_V1 + '/welcome-bonus-daily')
export const GET_USER_AUTHORIZED_REPORT_URL = api_mocker(API_URL_V1 + '/user/authorized-reports')
export const REPORT_BUSINESS_SNAPSHOT = api_mocker(API_URL_V1 + '/member/business-snapshot')

export const API_GET_VERIFY_CODE_PHONE = api_mocker(API_URL_V1 + '/mobile-code')
export const API_GET_VERIFY_CODE_EMAIL = api_mocker(API_URL_V1 + '/email-code')
export const API_POST_VERIFY_CODE_PHONE = api_mocker(API_URL_V1 + '/mobile-verify')
export const API_POST_VERIFY_CODE_EMAIL = api_mocker(API_URL_V1 + '/email-verify')
export const API_DYNAMIC_CONTENT = api_mocker(API_URL_V1 + '/country-dynamic-content/types')

export const API_GET_ENROLMENT_TYPES = api_mocker(API_URL_V1 + '/enrollment-types')
export const API_GET_ENROLMENT_TYPE_MEMBERSHIP = api_mocker(API_URL_V1 + '/enrollment-type-membership')

export const DOWNLOAD_SALES_APPLICATION_FORM = api_mocker(API_URL_V1 + '/download-sale-application-form')

export const API_CROSS_SPONSORING_VERIFICATION_CHECK = api_mocker(API_URL_V1 + '/member-cross-sponsoring-check')

export const API_GET_USER_ONDEMAND_VERIFICATION = api_mocker(API_URL_V1 + '/user-on-demand-verification')

// Commission Engine ===================================================================================================
export const COMMISSION_PLACEMENT_PREFERENCE = api_mocker(API_URL_V1 + '/commission/placement-preference')

// DASHBOARD DETAIL ====================================================================================================
export const DASHBOARD_DETAIL_ENDPOINT = api_mocker(API_URL_V1 + '/member/dashboard')
export const DASHBOARD_TVC_LEVEL_INFO = api_mocker(API_URL_V1 + '/team-volume-commission/rank')

// Notification Center =================================================================================================
export const NOTIFICATION_GET_NOTIFICATION_LIST = api_mocker(API_URL_V2 + '/notifications')
export const NOTIFICATION_READ_NOTIFICATION_LIST = api_mocker(API_URL_V2 + '/notifications/read')

// MY BUNDLE ===========================================================================================================
export const MY_BUNDLE_GET_BUNDLE_LIST = api_mocker(API_URL_V1 + '/bundle/get')
export const MY_BUNDLE_CREATE_BUNDLE = api_mocker(API_URL_V1 + '/bundle/create')
export const MY_BUNDLE_GET_BUNDLE_DETAILS = api_mocker(API_URL_V1 + '/bundle/get/')
export const MY_BUNDLE_UPDATE_BUNDLE = api_mocker(API_URL_V1 + '/bundle/update/')
export const MY_BUNDLE_REMOVE_BUNDLE = api_mocker(API_URL_V1 + '/bundle/delete/')

// MI SPACE ============================================================================================================
export const MISPACE_GET_ACCESS_CODE = api_mocker(API_URL_V1 + '/mi-space/request-access-code')

// SV TRANSFER =========================================================================================================
export const SV_TRANSFER_GET_SV_TRANSFER_LIST = api_mocker(API_URL_V1 + '/sales/sv-transfer')
export const SV_TRANSFER_GET_TRANSFER_PRODUCT_LIST = api_mocker(API_URL_V1 + '/sales/sv-transfer/product-kitting-list')
export const SV_TRANSFER_CREATE_SV_TRANSFER = api_mocker(API_URL_V1 + '/sales/sv-transfer')
export const SV_TRANSFER_GET_SC_TRANSFER_DETAILS = api_mocker(API_URL_V1 + '/sales/sv-transfer/')

// I TOKEN REDEMPTION ==================================================================================================
export const I_TOKEN_GET_VOUCHER_LIST = api_mocker(API_URL_V1 + '/itoken/voucher')
export const I_TOKEN_GET_VOUCHER_DETAILS = api_mocker(API_URL_V1 + '/itoken/voucher/')
export const I_TOKEN_GET_REDEMPTION_CHARGES = api_mocker(API_URL_V1 + '/itoken/campaign/calculate')
export const I_TOKEN_CREATE_REDEMPTION = api_mocker(API_URL_V1 + '/itoken/redemption')
export const I_TOKEN_GET_REDEMPTION_DETAILS = api_mocker(API_URL_V1 + '/itoken/redemption/')

// IP Whois ============================================================================================================
export const IP_WHOIS = api_mocker('https://ipwhois.app/json/')
export const CHECK_IP = api_mocker(API_URL_V1 + '/check-ip')
