package co.yixiang.yshop.module.distributor.enums;

import lombok.AllArgsConstructor;
import lombok.Getter;

import java.util.Objects;
import java.util.stream.Stream;

@Getter
@AllArgsConstructor
public enum DistributorOrderStatusEnum {

    WAIT(0, "待结算"),
    COMPLETE(1, "已结算"),
    CANCEL(2, "已取消");

    private Integer status;

    private String name;

    public static DistributorOrderStatusEnum toStatus(Integer status) {
        return Stream.of(DistributorOrderStatusEnum.values())
                .filter(p -> Objects.equals(p.status, status))
                .findAny()
                .orElse(null);
    }
}
