package net.lab1024.sa.admin.module.business.wms.receive.asn.constant;

import lombok.AllArgsConstructor;
import lombok.Getter;
import net.lab1024.sa.base.common.enumeration.BaseEnum;

@AllArgsConstructor
@Getter
public enum AsnOrderStatusEnum implements BaseEnum {

    CREATED("CREATED", "已创建"),

    APPROVING("APPROVING", "已提交"),

    APPROVED("APPROVED", "已审核"),

    PARTIALLY_IN("PARTIALLY_IN", "部分入库"),

    COMPLETED("COMPLETED", "已完成"),

    CANCELLED("CANCELLED", "已取消"),

    ;

    private final String value;

    private final String desc;

    /**
     * 根据 value 获取对应的 desc
     * @param value 枚举值
     * @return 对应的描述，如果未找到则返回 null
     */
    public static String getDescByValue(String value) {
        for (AsnOrderStatusEnum status : AsnOrderStatusEnum.values()) {
            if (status.getValue().equals(value)) {
                return status.getDesc();
            }
        }
        return null;
    }
}
