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

import cn.hutool.core.util.ArrayUtil;
import lombok.AllArgsConstructor;
import lombok.Getter;

@Getter
@AllArgsConstructor
public enum OrderTypeEnum {

    MAIN_ORDER(1, "主单"),
    SUPPLEMENT_ORDER(2, "补单"),
    AFTER_SALES_ORDER(3, "售后单"),
    BODY_ORDER(4, "柜体单"),
    HARDWARE_ORDER(5, "五金单"),
    MATERIAL_ORDER(6, "材料单");

    private final Integer status;
    private String description;

    /**
     * 子单类型
     */
    public static final int[] SUB_TYPES = {
            SUPPLEMENT_ORDER.status,
            AFTER_SALES_ORDER.status,
            BODY_ORDER.status,
            HARDWARE_ORDER.status,
            MATERIAL_ORDER.status
    };

    /**
     * 是否子单的类型
     *
     * @param status
     * @return
     */
    public static boolean isSubType(Integer status) {
        if (ArrayUtil.contains(SUB_TYPES, status)) {
            return true;
        }
        return false;
    }
}
