package com.cf.imes.module.executor.enums;

import lombok.AllArgsConstructor;
import lombok.Getter;

/**
 * 订单导入任务状态枚举
 *
 * @author Gqr
 * @since 2025/1/8 16:20
 */
@Getter
@AllArgsConstructor
public enum OrderImportTaskStatusEnum {
    /**
     * 创建未消费
     */
    CREATE_NOT_CONSUME(0),

    /**
     * 创建已接收
     */
    CREATE_RECEIVE(10),

    /**
     * 消费成功
     */
    CONSUME_SUCCESS(20),

    /**
     * 消费失败
     */
    CONSUME_FAIL(30),

    /**
     * 消费超时
     */
    CONSUME_TIMEOUT(40);

    private int status;

    /**
     * 是否匹配
     *
     * @param status
     * @return
     */
    public static OrderImportTaskStatusEnum match(int status) {
        for (OrderImportTaskStatusEnum statusEnum : OrderImportTaskStatusEnum.values()) {
            if (statusEnum.status == status) {
                return statusEnum;
            }
        }
        return null;
    }
}