package com.hzs.common.core.enums;

import com.hzs.common.core.constant.EnumsPrefixConstants;
import lombok.AllArgsConstructor;
import lombok.Getter;

/**
 * 交易类型
 */
@AllArgsConstructor
@Getter
public enum ETradeType {
    /**
     * 消费类
     */
    REGISTER_ORDER(101, 0, "注册订单", 0, EnumsPrefixConstants.TRADE_TYPE + 101, EOrderType.REGISTER_ORDER.getValue()),
    UPGRADE_ORDER(102, 0, "升级订单", 0, EnumsPrefixConstants.TRADE_TYPE + 102, EOrderType.UPGRADE_ORDER.getValue()),
    REPURCHASE_ORDER(103, 0, "复购订单", 0, EnumsPrefixConstants.TRADE_TYPE + 103, EOrderType.REPURCHASE_ORDER.getValue()),
    CONSUME_ORDER(110, 0, "消费订单", 0, EnumsPrefixConstants.TRADE_TYPE + 110, EOrderType.CONSUME_ORDER.getValue()),
    MALL_ORDER(114, 0, "商城订单", 0, EnumsPrefixConstants.TRADE_TYPE + 114, EOrderType.MALL_ORDER.getValue()),
    FICTITIOUS_ORDER(120, 0, "虚拟订单", 0, EnumsPrefixConstants.TRADE_TYPE + 120, EOrderType.FICTITIOUS_ORDER.getValue()),

    RETAIL_REGISTER_ORDER(141, 0, "新零售注册订单", 0, EnumsPrefixConstants.TRADE_TYPE + 141, EOrderType.RETAIL_REGISTER.getValue()),
    RETAIL_UPGRADE_ORDER(142, 0, "新零售升级订单", 0, EnumsPrefixConstants.TRADE_TYPE + 142, EOrderType.RETAIL_UPGRADE.getValue()),
    RETAIL_REPURCHASE_ORDER(143, 0, "新零售复购订单", 0, EnumsPrefixConstants.TRADE_TYPE + 143, EOrderType.RETAIL_REPURCHASE.getValue()),
    RETAIL_CONSUME_ORDER(144, 0, "新零售重消订单", 0, EnumsPrefixConstants.TRADE_TYPE + 144, EOrderType.RETAIL_CONSUME.getValue()),
    RETAIL_TICKET_ORDER(145, 0, "自主购票", 0, EnumsPrefixConstants.TRADE_TYPE + 145, EOrderType.RETAIL_TICKET.getValue()),

    EMPTY_ORDER(190, 190, "空单注册", 0, EnumsPrefixConstants.TRADE_TYPE + 190, EOrderType.REGISTER_ORDER.getValue()),

    /**
     * 提现
     */
    WITHDRAW(200, 301, "提现", 0, EnumsPrefixConstants.TRADE_TYPE + 200, -99),
    WITHDRAWAL_REFUSED(201, 0, "提现充正", 0, EnumsPrefixConstants.TRADE_TYPE + 201, -99),

    /**
     * 转账
     */
    TRANSFER(300, 0, "转账", 0, EnumsPrefixConstants.TRADE_TYPE + 300, -99),

    /**
     * 充值
     */
    OFF_LINE_RECHARGE(400, 300, "后台充值", 0, EnumsPrefixConstants.TRADE_TYPE + 400, -99),
    ON_LINE_RECHARGE(401, 0, "线上充值", 0, EnumsPrefixConstants.TRADE_TYPE + 401, -99),

    /**
     * 收益
     */
    INCOME_GRANT(500, 0, "收益发放", 0, EnumsPrefixConstants.TRADE_TYPE + 500, -99),
    ENCOURAGE_GRANT(501, 0, "鼓励金", 0, EnumsPrefixConstants.TRADE_TYPE + 501, -99),
    REGISTER_GRANT(503, 0, "注册赠送复购券", 0, EnumsPrefixConstants.TRADE_TYPE + 503, -99),
    /**
     * 直播代金券 抽奖发放
     */
    DRAW_REWARD(550, 0, "抽奖发放", 0, EnumsPrefixConstants.TRADE_TYPE + 550, -99),
    RECHARGE_DRAW_PAY_NUMBER(551, 0, "购买抽奖次数-充值", 0, EnumsPrefixConstants.TRADE_TYPE + 551, -99),
    DRAW_PAY_NUMBER(552, 0, "购买抽奖次数-支付", 0, EnumsPrefixConstants.TRADE_TYPE + 552, -99),

    /**
     * 退款
     */
    CANCELLATION_ORDER_REFUND(600, 0, "撤单返钱", 0, EnumsPrefixConstants.TRADE_TYPE + 600, -99),
    RETURN_MONEY(601, 0, "返还本金", 0, EnumsPrefixConstants.TRADE_TYPE + 601, -99),
    REVOKE_REGISTER_ORDER(602, 0, "注册订单撤单返钱", 0, EnumsPrefixConstants.TRADE_TYPE + 602, -EOrderType.REGISTER_ORDER.getValue()),
    REVOKE_UPGRADE_ORDER(603, 0, "升级订单撤单返钱", 0, EnumsPrefixConstants.TRADE_TYPE + 603, -EOrderType.UPGRADE_ORDER.getValue()),
    REVOKE_REPURCHASE_ORDER(604, 0, "复购订单撤单返钱", 0, EnumsPrefixConstants.TRADE_TYPE + 604, -EOrderType.REPURCHASE_ORDER.getValue()),
    REVOKE_CONSUME_ORDER(611, 0, "消费订单撤单返钱", 0, EnumsPrefixConstants.TRADE_TYPE + 611, -EOrderType.CONSUME_ORDER.getValue()),
    REVOKE_MALL_ORDER(615, 0, "商城订单撤单返钱", 0, EnumsPrefixConstants.TRADE_TYPE + 615, -EOrderType.MALL_ORDER.getValue()),
    REVOKE_FICTITIOUS_ORDER(618, 0, "虚拟订单撤单返钱", 0, EnumsPrefixConstants.TRADE_TYPE + 618, -EOrderType.FICTITIOUS_ORDER.getValue()),

    REVOKE_RETAIL_REGISTER_ORDER(641, 0, "新零售注册订单撤单", 0, EnumsPrefixConstants.TRADE_TYPE + 641, -EOrderType.RETAIL_REGISTER.getValue()),
    REVOKE_RETAIL_UPGRADE_ORDER(642, 0, "新零售升级订单撤单", 0, EnumsPrefixConstants.TRADE_TYPE + 642, -EOrderType.RETAIL_UPGRADE.getValue()),
    REVOKE_RETAIL_REPURCHASE_ORDER(643, 0, "新零售复购订单撤单", 0, EnumsPrefixConstants.TRADE_TYPE + 643, -EOrderType.RETAIL_REPURCHASE.getValue()),
    REVOKE_RETAIL_CONSUME_ORDER(644, 0, "新零售重消订单撤单", 0, EnumsPrefixConstants.TRADE_TYPE + 644, -EOrderType.RETAIL_CONSUME.getValue()),
    REVOKE_RETAIL_TICKET_ORDER(645, 0, "自主购票撤单", 0, EnumsPrefixConstants.TRADE_TYPE + 645, -EOrderType.RETAIL_TICKET.getValue()),

    ORDER_SELF_DELIVER(680, 0, "自提返还邮费", 0, EnumsPrefixConstants.TRADE_TYPE + 680, -99),

    ORDER_REFUND_ADJUST(690, 0, "退单金额补差", 0, EnumsPrefixConstants.TRADE_TYPE + 690, -99),

    /**
     * 办理业务
     */
    CHANGE_NAME(800, 100, "变更会员姓名", 0, EnumsPrefixConstants.TRADE_TYPE + 800, -99),
    CHANGE_CONTACT_INFORMATION(801, 101, "变更联系方式", 0, EnumsPrefixConstants.TRADE_TYPE + 801, -99),
    RESET_PASSWORDS(802, 103, "重置密码", 0, EnumsPrefixConstants.TRADE_TYPE + 802, -99),
    RESET_BANK_INFORMATION(803, 112, "重置银行信息", 0, EnumsPrefixConstants.TRADE_TYPE + 803, -99),
    MODIFY_REGISTRATION_LEVEL(804, 106, "修改注册等级", 0, EnumsPrefixConstants.TRADE_TYPE + 804, -99),
    MODIFY_SETTLEMENT_LEVEL(805, 113, "修改结算等级", 0, EnumsPrefixConstants.TRADE_TYPE + 805, -99),
    MODIFY_REAL_AWARDS(806, 107, "修改真实奖衔", 0, EnumsPrefixConstants.TRADE_TYPE + 806, -99),
    MODIFY_SETTLEMENT_COUNTRY(807, 124, "修改结算国家", 0, EnumsPrefixConstants.TRADE_TYPE + 807, -99),
    MODIFY_NATURAL_COUNTRY(808, 115, "修改自然国家", 0, EnumsPrefixConstants.TRADE_TYPE + 808, -99),
    MODIFY_LOGIN_STATUS(809, 116, "修改登录状态", 0, EnumsPrefixConstants.TRADE_TYPE + 809, -99),
    MODIFY_EARNINGS_STATUS(810, 117, "修改收益状态", 0, EnumsPrefixConstants.TRADE_TYPE + 810, -99),
    MODIFY_WALLET_STATUS(811, 118, "修改钱包状态", 0, EnumsPrefixConstants.TRADE_TYPE + 811, -99),
    MODIFY_EXAMINATION_STATUS(812, 119, "修改免考状态", 0, EnumsPrefixConstants.TRADE_TYPE + 812, -99),
    MODIFY_REGISTRATION_PERMISSIONS(813, 120, "修改注册权限", 0, EnumsPrefixConstants.TRADE_TYPE + 813, -99),
    MODIFY_REAL_MAX_AWARDS(814, 166, "修改历史最高奖衔", 0, EnumsPrefixConstants.TRADE_TYPE + 814, -99),
    MEMBER_ACHIEVE(816, 123, "注水业绩", 0, EnumsPrefixConstants.TRADE_TYPE + 816, -99),
    POLICY_CURRENCY_YES_NO(817, 125, "办理政策币", 0, EnumsPrefixConstants.TRADE_TYPE + 817, -99),
    AWARDS_CONTROL_SAVE(818, 128, "新增真实奖衔控制", 0, EnumsPrefixConstants.TRADE_TYPE + 818, -99),
    AWARDS_CONTROL_MODIFY(819, 129, "修改真实奖衔控制", 0, EnumsPrefixConstants.TRADE_TYPE + 819, -99),
    AWARDS_CONTROL_DELETE(820, 130, "删除真实奖衔控制", 0, EnumsPrefixConstants.TRADE_TYPE + 820, -99),
    MEMBER_PARENT(823, 111, "修改直推", 0, EnumsPrefixConstants.TRADE_TYPE + 823, -99),
    MEMBER_PLACE_PARENT(824, 110, "修改安置", 0, EnumsPrefixConstants.TRADE_TYPE + 824, -99),
    DEL_POLICY_CURRENCY_YES_NO(825, 126, "删除办理政策币", 0, EnumsPrefixConstants.TRADE_TYPE + 825, -99),

    REAL_NAME_AUTHENTICATION(826, 102, "实名认证", 0, EnumsPrefixConstants.TRADE_TYPE + 826, -99),
    IS_ACTIVATE(827, 137, "是否激活", 0, EnumsPrefixConstants.TRADE_TYPE + 827, -99),

    /**
     * 订单修改地址
     */
    ORDER_CHANGE_ADDRESS(830, 231, "修改地址", 0, EnumsPrefixConstants.TRADE_TYPE + "830", -99),
    /**
     * 订单调换货物
     */
    ORDER_CHANGE_PRODUCT(831, 232, "调换货物", 0, EnumsPrefixConstants.TRADE_TYPE + "831", -99),

    /**
     * 订单撤销订单
     */
    ORDER_CANCEL(832, 234, "撤销订单", 0, EnumsPrefixConstants.TRADE_TYPE + "832", -99),
    /**
     * 订单撤销产品
     */
    ORDER_CANCEL_PRODUCT(833, 235, "撤销产品", 0, EnumsPrefixConstants.TRADE_TYPE + "833", -99),

    /**
     * 订单退单
     */
    ORDER_RETURN(834, 233, "退单", 0, EnumsPrefixConstants.TRADE_TYPE + "834", -99),

    /**
     * 自助服务-修改收货地址
     */
    SELF_MODIFY_ADDRESS(900, 131, "修改收货地址", 0, EnumsPrefixConstants.TRADE_TYPE + "900", -99),

    /**
     * 自助服务-户籍变更
     */
    DOMICILE_CHANGE(901, 132, "户籍变更", 0, EnumsPrefixConstants.TRADE_TYPE + "901", -99),
    ;

    /**
     * 实际值
     */
    private final int value;

    /**
     * 审核对应的值
     */
    private final int approvalValue;
    /**
     * 显示标签
     */
    private final String label;
    /**
     * 是否启用（0=是,1=否） -- 来源EYesNo
     */
    private final int enable;

    /**
     * 国际化翻译key值
     */
    private final String key;

    private final int orderType;


    /**
     * 获取字典标签值
     *
     * @param value
     * @return String
     */
    public static String getTradeLabel(int value) {
        for (ETradeType type : ETradeType.values()) {
            if (type.getValue() == value) {
                return type.getLabel();
            }
        }
        return "";
    }


    /**
     * 根据审批值查询value值
     *
     * @param value 审批值
     * @return int
     */
    public static int getValueByApprovalValue(int value) {
        for (ETradeType type : ETradeType.values()) {
            if (type.approvalValue == value) {
                return type.getValue();
            }
        }
        return 0;
    }

}
