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

import lombok.AllArgsConstructor;
import lombok.Getter;

import java.util.stream.Stream;

/**
 * @author moxiangrong
 * 下单类型枚举
 */
@Getter
@AllArgsConstructor
public enum OrderTypeEnum {

    NORMAL_ORDER(1, "正常下单"),
    CAMPAIGN_ORDER(2, "活动下单");


    private Integer value;
    private String desc;

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


}
