package com.ylx.massage.enums;

import lombok.Getter;

/**
 * 售后类型枚举
 */
@Getter
public enum AfterSaleTypeEnum {

    RETURN_GOODS(1, "退货"),

    EXCHANGE_GOODS(2, "换货"),

    NOT_RECEIVED(3, "未收到货");

    private final Integer code;
    private final String info;

    AfterSaleTypeEnum(Integer code, String info) {
        this.code = code;
        this.info = info;
    }

    /**
     * 根据code获取枚举值
     * @param code 代码
     * @return 枚举值
     */
    public static AfterSaleTypeEnum valueOf(Integer code) {
        if (code == null) {
            return null;
        }
        for (AfterSaleTypeEnum value : AfterSaleTypeEnum.values()) {
            if (value.getCode().equals(code)) {
                return value;
            }
        }
        return null;
    }
}
