package com.qnfhq.modules.c2c.enums;

import java.util.Arrays;

public enum C2cOrderFlowEnum {

    PROGRESS(0,"进行中"),
    END(1,"已结束"),
    UNKNOWN(-1,"未知");

    private Integer code;

    private String desc;

    public Integer getCode()
    {
        return code;
    }

    public String getDesc()
    {
        return desc;
    }

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

    public static C2cOrderFlowEnum getByKey(int key) {
        return Arrays.asList(C2cOrderFlowEnum.values()).stream()
                .filter(a -> a.getCode().intValue() == key)
                .findFirst().orElse(C2cOrderFlowEnum.UNKNOWN);
    }
}
