package com.sckw.payment.model.constant;

import com.sckw.stream.enums.MessageEnum;
import lombok.Getter;

/**
 * 跳转地址
 *
 * @author xucaiqin
 * @date 2023-07-11 12:00:52
 */
@Getter
public enum JumpEnum {
    LEDGER_SELL("ledgerSell", MessageEnum.LEDGER_SELL),
    LEDGER_REVOCATION_SELL("ledgerSell", MessageEnum.LEDGER_REVOCATION_SELL),
    LEDGER_CONFIRM_SELL("ledgerSell", MessageEnum.LEDGER_CONFIRM_SELL),
    LEDGER_SUCCESS_SELL("ledgerSell", MessageEnum.LEDGER_SUCCESS_SELL),
    LEDGER_BACK_SELL("ledgerSell", MessageEnum.LEDGER_BACK_SELL),
    LEDGER_PURCHASE("ledgerPurchase", MessageEnum.LEDGER_PURCHASE),
    LEDGER_REVOCATION_PURCHASE("ledgerPurchase", MessageEnum.LEDGER_REVOCATION_PURCHASE),
    LEDGER_CONFIRM_PURCHASE("ledgerPurchase", MessageEnum.LEDGER_CONFIRM_PURCHASE),
    LEDGER_SUCCESS_PURCHASE("ledgerPurchase", MessageEnum.LEDGER_SUCCESS_PURCHASE),
    LEDGER_BACK_PURCHASE("ledgerPurchase", MessageEnum.LEDGER_BACK_PURCHASE),

    LEDGER_CARRIER("ledgerCarrier", MessageEnum.LEDGER_CARRIER),
    LEDGER_SHIPPER("ledgerShipper", MessageEnum.LEDGER_SHIPPER),
    LEDGER_REVOCATION_CARRIER("ledgerCarrier", MessageEnum.LEDGER_REVOCATION_CARRIER),
    LEDGER_REVOCATION_SHIPPER("ledgerShipper", MessageEnum.LEDGER_REVOCATION_SHIPPER),
    LEDGER_CONFIRM_CARRIER("ledgerCarrier", MessageEnum.LEDGER_CONFIRM_CARRIER),
    LEDGER_CONFIRM_SHIPPER("ledgerShipper", MessageEnum.LEDGER_CONFIRM_SHIPPER),
    LEDGER_SUCCESS_CARRIER("ledgerCarrier", MessageEnum.LEDGER_SUCCESS_CARRIER),
    LEDGER_SUCCESS_SHIPPER("ledgerShipper", MessageEnum.LEDGER_SUCCESS_SHIPPER),
    LEDGER_BACK_CARRIER("ledgerCarrier", MessageEnum.LEDGER_BACK_CARRIER),
    LEDGER_BACK_SHIPPER("ledgerShipper", MessageEnum.LEDGER_BACK_SHIPPER),

    SETTLEMENT_SELL("settlementSell", MessageEnum.SETTLEMENT_SELL),
    SETTLEMENT_PURCHASE("settlementPurchase", MessageEnum.SETTLEMENT_PURCHASE),
    SETTLEMENT_CONFIRM_SELL("ledgerPurchase", MessageEnum.SETTLEMENT_CONFIRM_SELL),
    SETTLEMENT_CONFIRM_PURCHASE("settlementPurchase", MessageEnum.SETTLEMENT_CONFIRM_PURCHASE),
    SETTLEMENT_START_SELL("settlementSell", MessageEnum.SETTLEMENT_START_SELL),
    SETTLEMENT_START_PURCHASE("settlementPurchase", MessageEnum.SETTLEMENT_START_PURCHASE),

    SETTLEMENT_CARRIER("settlementCarrier", MessageEnum.SETTLEMENT_CARRIER),
    SETTLEMENT_SHIPPER("settlementShipper", MessageEnum.SETTLEMENT_SHIPPER),
    SETTLEMENT_CONFIRM_CARRIER("settlementCarrier", MessageEnum.SETTLEMENT_CONFIRM_CARRIER),
    SETTLEMENT_CONFIRM_SHIPPER("settlementShipper", MessageEnum.SETTLEMENT_CONFIRM_SHIPPER),
    SETTLEMENT_START_CARRIER("settlementCarrier", MessageEnum.SETTLEMENT_START_CARRIER),
    SETTLEMENT_START_SHIPPER("settlementShipper", MessageEnum.SETTLEMENT_START_SHIPPER),
    ;
    /**
     * nacos种配置的前端跳转url
     */
    private final String key;

    private final MessageEnum messageEnum;


    JumpEnum(String key, MessageEnum messageEnum) {
        this.key = key;
        this.messageEnum = messageEnum;
    }

    /**
     * 通过消息枚举值，获取跳转地址key
     *
     * @param messageEnum
     * @return
     */
    public static String getByEnum(MessageEnum messageEnum) {
        for (JumpEnum value : JumpEnum.values()) {
            if (value.getMessageEnum() == messageEnum) {
                return value.getKey();
            }
        }
        return "";
    }

}
