package net.lab1024.sa.admin.module.business.wms.shipping.pick.constant;

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

@AllArgsConstructor
@Getter
public enum PickOrderStatusEnum implements BaseEnum {

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

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

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

    PARTIALLY_ALLOCATED("PARTIALLY_ALLOCATED", "部分分配"),

    ALLOCATED("ALLOCATED", "已分配"),

    PARTIALLY_PICKED("PARTIALLY_PICKED", "部分拣货"),

    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 (PickOrderStatusEnum status : PickOrderStatusEnum.values()) {
            if (status.getValue().equals(value)) {
                return status.getDesc();
            }
        }
        return null;
    }
}
