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

import lombok.AllArgsConstructor;
import lombok.Getter;

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

/**
 * 分销商字典枚举
 */
@Getter
@AllArgsConstructor
public enum DistributorDictEnum {

    DISTRIBUTOR_USER_EXPIRE("distributor_user_expire", "客户保护天数"),
    DISTRIBUTOR_APPLY("distributor_apply", "自动审核开关"),
    DISTRIBUTOR_PURCHASE("distributor_purchase", "自购返佣开关"),
    DISTRIBUTOR_AGREEMENT("distributor_agreement", "分销商协议"),
    ;

    private String dictType;

    private String label;

    public static DistributorDictEnum toDictType(Integer dictType) {
        return Stream.of(DistributorDictEnum.values())
                .filter(p -> Objects.equals(p.dictType, dictType))
                .findAny()
                .orElse(null);
    }

}
