package com.fs.hisStore.enums;

import lombok.AllArgsConstructor;
import lombok.Getter;

import java.util.stream.Stream;

@Getter
@AllArgsConstructor
public enum OrderInfoEnum {
    STATUS_NE1(-1,"申请退款"),
    STATUS_NE2(-2,"退款成功"),
    STATUS_NE3(-3,"已取消"),
    STATUS_0(0,"待支付"),
    STATUS_1(1,"待发货"),
    STATUS_2(2,"待收货"),
    STATUS_3(3,"已完成"),
    STATUS_4(4,"待评价"),

    PAY_STATUS_0(0,"未支付"),
    PAY_STATUS_1(1,"已支付"),

    REFUND_STATUS_0(0,"正常"),
    REFUND_STATUS_1(1,"退款中"),
    REFUND_STATUS_2(2,"已退款"),


    CANCEL_STATUS_0(0,"正常"),
    CANCEL_STATUS_1(1,"已取消"),

    CONFIRM_STATUS_0(0,"正常"),
    CONFIRM_STATUS_1(1,"确认"),

    PAY_CHANNEL_1(1,"小程序支付渠道");

    private Integer value;
    private String desc;

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