package com.crm.rely.backend.util;

/**
 * Created by max on 2020/5/8.
 */
public class TranslateUtil {

    public static String statusToName(Integer status) {
        if (status == null) {
            return "";
        }

        if (status == 1) {
            return "approving";
        } else if (status == 2) {
            return "passed";
        } else if (status == 3) {
            return "rejected";
        } else if (status == 99) {
            return "incomplete";
        } else {
            return "";
        }

    }

    public static String statusToName(Integer status, Integer callbackStatus, Integer withdrawStatus) {
        if (status == null) {
            return "";
        }

        if (status == 1) {
            return "approving";
        } else if (status == 2) {
            if (withdrawStatus != null && callbackStatus != null && callbackStatus == 0 && withdrawStatus == 2) {
                return "processing_withdraw";
            }
            if (withdrawStatus != null && (withdrawStatus == 0 || withdrawStatus == 1)) {
                return "processing_not_withdraw";
            }
            if (withdrawStatus != null && callbackStatus != null && withdrawStatus == 2 && callbackStatus == 1) {
                return "passed";
            }
            return "";
        } else if (status == 3) {
            return "rejected";
        } else if (status == 99) {
            return "incomplete";
        } else {
            return "";
        }

    }

    public static String groupTypeToName(Long groupType, String lang) {
        if (groupType == null) {
            return "";
        }
        return groupTypeToName(groupType.longValue(), lang);
    }

    public static String groupTypeToName(Long groupType) {
        if (groupType == null) {
            return "";
        }
        return groupTypeToName(groupType.longValue());
    }

    public static String groupTypeToName(long groupType, String lang) {
        return groupTypeToName((int) groupType, lang);
    }

    public static String groupTypeToName(long groupType) {
        return groupTypeToName((int) groupType);
    }

    public static String groupTypeToName(Integer groupType) {
        if (groupType == null) {
            return "";
        }
        return groupTypeToName(groupType.intValue());
    }

    public static String groupTypeToName(Integer groupType, String lang) {
        if (groupType == null) {
            return "";
        }
        return groupTypeToName(groupType.intValue(), lang);
    }

    public static String groupTypeToName(int groupType) {

        return groupTypeToName(groupType, "EN");
    }

    public static String groupTypeToName(int groupType, String lang) {

        if (groupType == 1) {
            if ("CN".equals(lang)) {
                return "经典账户";
            }
            return "classic";
        } else if (groupType == 2) {
            if ("CN".equals(lang)) {
                return "ECN";
            }
            return "vip";
        } else if (groupType == 3) {
            if ("CN".equals(lang)) {
                return "机构账户";
            }
            return "org";
        } else if (groupType == 4) {
            if ("CN".equals(lang)) {
                return "专业账户";
            }
            return "pro";
        } else if (groupType == 5 || groupType == 6) {
            if ("CN".equals(lang)) {
                return "极速账户";
            }
            return "instant";
        }  else if (groupType == 7) {
            if ("CN".equals(lang)) {
                return "标准账户";
            }
            return "standard";
        }  else if (groupType == 8) {
            if ("CN".equals(lang)) {
                return "美分账户";
            }
            return "cent";
        } else {
            return "";
        }
    }


    public static String identityTypeToName(Integer identityType) {
        if (identityType == null) {
            return "";
        }
        if (identityType == 1) {
            return "id_card";
        } else if (identityType == 2) {
            return "Hometown_permit";
        } else if (identityType == 3) {
            return "MTPs";
        } else if (identityType == 4) {
            return "Passport";
        } else {
            return "";
        }
    }

    public static String symbolTypeToName(int type) {
        if (type == 1) {
            return "FX";
        } else if (type == 2) {
            return "CFD";
        } else if (type == 3) {
            return "INDEX";
        } else if (type == 4) {
            return "METAL";
        } else if (type == 5) {
            return "US_STOCK";
        } else if (type == 6) {
            return "HK_STOCK";
        } else {
            return "";
        }
    }

    public static String scaleToName(int scale) {
        if (scale == 1) {
            return "1:100";
        } else if (scale == 2) {
            return "1:1000";
        } else if (scale == 3) {
            return "1:10000";
        } else {
            return "";
        }
    }

    public static String posToName(int pos) {
        if (pos == 1) {
            return "A";
        } else if (pos == 2) {
            return "B";
        } else {
            return "";
        }
    }

    public static String balanceOperateTypeToName(int type) {
        if (type == 1) {
            return "balance_add";
        } else if (type == 2) {
            return "balance_dismiss";
        } else {
            return "";
        }
    }

    public static String balanceTypeToName(int type) {
        if (type == 1) {
            return "rebate";
        } else if (type == 2) {
            return "commission";
        } else {
            return "";
        }
    }

    public static String pointTypeToName(int type) {
        if (type == 1) {
            return "symbol_volume";
        } else if (type == 2) {
            return "percent";
        } else {
            return "";
        }
    }

    public static String mamSubsApplyTypeToName(int type) {
        if (type == 1) {
            return "subs_append";
        } else if (type == 2) {
            return "subs_remove";
        } else {
            return "";
        }
    }

    public static String mamSubsApplyStatusToName(int status, int confirmed) {

        if (status == 1) {
            if (confirmed == 0) {
                return "approving_not_confirmed";
            } else {
                return "approving_confirmed";
            }
        } else if (status == 2) {
            return "passed";
        } else if (status == 3) {
            return "rejected";
        } else if (status == 99) {
            return "incomplete";
        } else {
            return "";
        }
    }

    public static String agentBalanceWithdrawalTypeToName(int type) {
        if (type == 1) {
            return "agent_balance_transfer";
        } else if (type == 2) {
            return "agent_balance_withdrawal";
        } else {
            return "";
        }
    }

    public static String ibInvalidToName(int type) {
        if (type == 0) {
            return "positive";
        } else if (type == 1) {
            return "negative";
        } else {
            return "";
        }
    }

    public static String rebateValidToName(int type) {
        if (type == 0) {
            return "negative";
        } else if (type == 1) {
            return "positive";
        } else {
            return "";
        }
    }

    public static String commissionValidToName(int type) {
        if (type == 0) {
            return "negative";
        } else if (type == 1) {
            return "positive";
        } else {
            return "";
        }
    }

    public static String integralValidToName(int type) {
        if (type == 0) {
            return "negative";
        } else if (type == 1) {
            return "positive";
        } else {
            return "";
        }
    }

    public static String mamTypeToName(int type) {
        if (type == 1) {
            return "mam";
        } else if (type == 2) {
            return "pamm";
        } else if (type == 3) {
            return "pamm_manager";
        } else {
            return "";
        }
    }

}
