export const FINANCE_PERMISSIONS = {
    auditWithdrawalApplications: "finance-withdrawal:audit",
    auditOperationsWithdrawalApplications: "operations-withdrawal:audit",
    configureCoinSellerRechargeExchangeRate: "coin-seller:exchange-rate",
    createCoinSellerRechargeOrder: "finance-order:coin-seller-recharge:create",
    grantCoinSellerRechargeOrder: "finance-order:coin-seller-recharge:grant",
    updateUSDTAddress: "finance-order:usdt-address:update",
    verifyCoinSellerRechargeOrder: "finance-order:coin-seller-recharge:verify",
    viewCoinSellerRechargeOrders: "finance-order:coin-seller-recharge:view",
    viewAppRechargeDetails: "payment-bill:view",
    viewOperationsWithdrawalApplications: "operations-withdrawal:view",
    viewWithdrawalApplications: "finance-withdrawal:view",
};

export const WITHDRAWAL_STATUS = [
    ["pending", "待审核"],
    ["rejecting", "拒绝处理中"],
    ["approved", "已通过"],
    ["rejected", "已拒绝"],
    ["skipped", "存量跳过运营审核"],
];

export const COIN_SELLER_RECHARGE_PROVIDERS = [
    ["mifapay", "MiFaPay"],
    ["v5pay", "V5Pay"],
    ["usdt", "USDT"],
];

export const COIN_SELLER_RECHARGE_CHAINS = [
    ["C2C", "Binance Pay / C2C"],
    ["OFFCHAIN", "Binance 站内转账 / Off-chain"],
    ["TRON", "TRON"],
    ["BSC", "BSC"],
];

// 三方回单使用 ISO 4217 字母代码，前端不再维护渠道币种白名单；白名单会随渠道扩区而过期，
// 造成后端能够校验的订单在录单入口不可选。Intl 数据来自浏览器运行时，并保留旧浏览器所需的现有币种兜底。
const FALLBACK_PROVIDER_CURRENCIES = [
    "AED",
    "BDT",
    "BHD",
    "BRL",
    "EGP",
    "IDR",
    "INR",
    "KWD",
    "MXN",
    "OMR",
    "PHP",
    "PKR",
    "QAR",
    "SAR",
    "TRY",
    "VND",
];
export const COIN_SELLER_RECHARGE_CURRENCIES = [
    ...new Set(
        typeof Intl.supportedValuesOf === "function"
            ? [...Intl.supportedValuesOf("currency"), ...FALLBACK_PROVIDER_CURRENCIES]
            : FALLBACK_PROVIDER_CURRENCIES,
    ),
].sort();

export const COIN_SELLER_RECHARGE_PROVIDER_CURRENCIES = {
    mifapay: COIN_SELLER_RECHARGE_CURRENCIES,
    v5pay: COIN_SELLER_RECHARGE_CURRENCIES,
};

export const COIN_SELLER_RECHARGE_STATUS = [
    ["pending", "待处理"],
    ["verified", "已校验"],
    ["granted", "已发放"],
    ["failed", "失败"],
    ["canceled", "已取消"],
];

export const COIN_SELLER_RECHARGE_VERIFY_STATUS = [
    ["pending", "待校验"],
    ["verified", "校验通过"],
    ["failed", "校验失败"],
];

export const COIN_SELLER_RECHARGE_GRANT_STATUS = [
    ["pending", "待发放"],
    ["granted", "已发放"],
    ["failed", "发放失败"],
];

export const DEFAULT_COIN_SELLER_RECHARGE_ORDER_FORM = {
    appCode: "",
    chain: "",
    coinAmount: "",
    externalOrderNo: "",
    isMakeup: false,
    orderDateMs: "",
    providerAmount: "",
    providerCode: "mifapay",
    providerCurrencyCode: "",
    remark: "",
    targetUserId: "",
    usdAmount: "",
};
