package com.fs.erp.dto.sdk.wangdian.enums;

public enum DeliveryTerm {
    PAYMENT_BEFORE_DELIVERY(1, "款到发货"),
    CASH_ON_DELIVERY(2, "货到付款(包含部分货到付款)"),
    INSTALLMENT_PAYMENT(3, "分期付款"),
    CREDIT_ACCOUNT(4, "挂账");

    private final int value;
    private final String description;

    DeliveryTerm(int value, String description) {
        this.value = value;
        this.description = description;
    }

    public int getValue() {
        return value;
    }

    public String getDescription() {
        return description;
    }

    /**
     * 根据状态值获取枚举实例
     *
     * @param value 状态值
     * @return 对应的枚举实例，如果找不到则返回 null
     */
    public static DeliveryTerm fromValue(int value) {
        for (DeliveryTerm term : DeliveryTerm.values()) {
            if (term.value == value) {
                return term;
            }
        }
        return null;
    }
}
