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

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


    DEPOSIT(1, "ATCH"),
    WITHDRAWAL(2, "DTCH"),
    PERFFEE_CHAGED_HWM(3, "PERFFEE CHARGED HWM"),//PerfFee Charged HWM:1000.00; Ba 子账户盈利分成扣除,1000为起始资金
    PERFFEE_DETACHED_HWM(4, "PERFFEE DETACHED HWM"),//PerfFee Detached HWM:2000.0; Ba 子账户提前结算
    PRFEE_HWM(5, "PRFEE"),//PrFee:100001 HWM:99.16  正常结算打入资金
    DPRFEE_HWM(6, "DPRFEE");//DPrFee:100002 HWM:198.00   中途撤出结算打入资金


    private final Integer code;
    private final String desc;

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

    public Integer getCode() {
        return code;
    }

    public String getDesc() {
        return desc;
    }

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

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

    public static PammDwType matchStartDesc(String desc) {
        for (PammDwType type : PammDwType.values()) {
            if (desc.toUpperCase().startsWith(type.getDesc())) {
                return type;
            }
        }
        return null;
    }

}
