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

    PAY(0, "支付后结算"),
    CONFIRM(1, "确认收获后结算"),
    COMPLETE(2, "订单完成结算");

    private Integer type;

    private String name;

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