package org.springblade.common.enums;

import lombok.Getter;

/**
 * 优惠券类型枚举
 */
@Getter
public enum PreferentialTypeEnum {
	DISCOUNT("折扣券", 1),
	FULL_SUBTRACTION("满减券", 2),
	THRESHOLD_FREE("无门槛", 3);
	private String name;
	private Integer value;

	PreferentialTypeEnum(String name, Integer value) {
		this.name = name;
		this.value = value;
	}

	public static String getNameByValue(Integer value) {
		for (PreferentialTypeEnum orderTypeEnum : PreferentialTypeEnum.values()) {
			if (orderTypeEnum.value.equals(value)) {
				return orderTypeEnum.getName();
			}
		}
		return "未知";
	}
}
