package com.ylx.order.enums;

import lombok.Getter;

@Getter
public enum AfterSaleServiceDictTypeEnum {


    /**
     * 售后退款原因 (对应前端传参: 1)
     */
    REFUND_REASON(1, "after_sales_service_reason"),

    /**
     * 客户端订单取消原因 (对应前端传参: 2)
     */
    ORDER_CANCELLED_REASON_CUSTOMER(2, "order_cancelled_reason_customer"),

    /**
     * 商户端端订单取消原因 (对应前端传参: 3)
     */
    ORDER_CANCELLED_REASON_MERCHANT(3, "order_cancelled_reason_merchant");

    private final Integer code;
    private final String desc;

    AfterSaleServiceDictTypeEnum(Integer code, String desc) {
        this.code = code;
        this.desc = desc;
    }

    public static String getDictTypeByCode(Integer code) {
        if (code == null) return null;
        for (AfterSaleServiceDictTypeEnum e : values()) {
            if (e.getCode().equals(code)) {
                return e.getDesc();
            }
        }
        return null;
    }
}
