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 DistributorLevelUpTypeEnum {

    ONLY(0, "任意"),
    ALL(1, "全部"),
    ;

    private Integer type;

    private String name;

    public static DistributorLevelUpTypeEnum toType(Integer type) {
        return Stream.of(DistributorLevelUpTypeEnum.values())
                .filter(p -> Objects.equals(p.type, type))
                .findAny()
                .orElse(null);
    }

}
