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

    WAIT(0, "待入账"),
    COMPLETE(1, "已入账"),
    CANCEL(2, "已取消"),
    WITHDRAW_WAIT(3, "提现中"),
    WITHDRAW_COMPLETE(4, "提现成功"),
    WITHDRAW_FAIL(5, "提现失败"),
    ;

    private Integer type;

    private String name;

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