package com.qnfhq.modules.c2c.enums;

import java.util.Arrays;


public enum C2cOrderStatusEnum {

    CREATE(0,"未付款"),
    PAY(1,"已付款"),
    COMPLAIN(2,"申诉"),
    COMPLETE(3,"已完成"),
    CANCEL(4,"已取消"),
    UNKNOWN(-1,"未知");

    private Integer code;

    private String desc;

    public Integer getCode()
    {
        return code;
    }

    public String getDesc()
    {
        return desc;
    }

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

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