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

    NOT_APPLIED(-1, "已清退"),
    AUDIT(0, "待审核"),
    PASSED(1, "已通过"),
    REFUSED(2, "已拒绝");

    private Integer status;

    private String name;

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