/**
 * Copyright (C) 2018-2022
 * All rights reserved, Designed By www.yixiang.co
 */
package co.yixiang.yshop.module.order.enums;

import lombok.AllArgsConstructor;
import lombok.Getter;

import java.util.stream.Stream;

/**
 * @author hupeng
 * 订单相关枚举
 */
@Getter
@AllArgsConstructor
public enum OrderStatusEnum {

    STATUS_ALL(-1, "全部订单"),
    STATUS_WAIT_PAY(0, "未支付"),
    STATUS_WAIT_SEND(1, "未发货"),
    STATUS_WAIT_RECEIVED(2, "待收货"),
    STATUS_WAIT_EVALUATE(3, "待评价"),
    STATUS_FINISH(4, "已完成"),
    STATUS_WAIT_FOR_GROUP(5, "待成团"),
    STATUS_MINUS_BEING_REFUND(-1, "退款中"),
    STATUS_MINUS_REFUNDED(-2, "已退款"),
    STATUS_MINUS_REFUND(-3, "退款"),
    STATUS_GROUP_FAILURE(-4, "成团失败");


    private Integer value;
    private String desc;

    public static OrderStatusEnum toType(int value) {
        return Stream.of(OrderStatusEnum.values())
                .filter(p -> p.value == value)
                .findAny()
                .orElse(null);
    }


}
