package com.crm.rely.backend.core.constant;

/**
 * PM出入金信息
 *
 * @author y
 * @create 2022/1/21
 */
public enum PmDwType {


    DEPOSIT_TO(1, "deposit to"),
    DEPOSIT_BY(2, "deposit by"),
    WITHDRAW_FROM(3, "withdraw from"),
    WITHDRAW_BY(4, "withdraw by"),
    WITHDRAW_FEES(5,"withdraw fees"),
    AUTO_WITHDRAW(6,"auto withdraw");


    private final Integer code;
    private final String desc;

    PmDwType(Integer code, String desc) {
        this.code = code;
        this.desc = desc;
    }

    public Integer getCode() {
        return code;
    }

    public String getDesc() {
        return desc;
    }

    public static PmDwType matchCode(Integer code) {
        for (PmDwType type : PmDwType.values()) {
            if (type.getCode() == code) {
                return type;
            }
        }
        return null;
    }

    public static PmDwType matchDesc(String desc) {
        for (PmDwType type : PmDwType.values()) {
            if (type.getDesc().equalsIgnoreCase(desc)) {
                return type;
            }
        }
        return null;
    }


}
