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

import com.cf.imes.framework.common.core.IntArrayValuable;
import lombok.Getter;
import lombok.RequiredArgsConstructor;

import java.util.Arrays;

/**
 * 部件加工状态枚举
 *
 * @author Gqr
 * @since 2026/1/29 11:03
 */
@RequiredArgsConstructor
@Getter
public enum OrderComponentProcessStatusEnum implements IntArrayValuable {
    /**
     * 不加工
     */
    NOT_PROCESS(0),

    /**
     * 未加工
     */
    UNPROCESSED(1),

    /**
     * 已加工
     */
    PROCESSED(2),

    /**
     * 部分加工
     */
    PART_PROCESSED(3);

    public static final int[] ARRAYS = Arrays.stream(values()).mapToInt(OrderComponentProcessStatusEnum::getStatus).toArray();

    @Override
    public int[] array() {
        return ARRAYS;
    }

    private final Integer status;

    // from value
    public static OrderComponentProcessStatusEnum fromValue(Integer value) {
        for (OrderComponentProcessStatusEnum unit : OrderComponentProcessStatusEnum.values()) {
            if (unit.getStatus().equals(value)) {
                return unit;
            }
        }
        return null;
    }
}
