package com.ruoyi.order.domain.dto;

public enum OrderTypeEnum {
    /** 未知 */
    UNKNOWN("UNKNOWN", 0L),
    /** 调整 */
    ADJUSTMENT("TZ", 1L),
    /** 调拨 */
    ALLOCATION("DB", 2L),
    /** 借出 */
    LEND("JC", 3L),
    /** 拆分 */
    SPLIT("CF", 4L),
    /** 闲置 */
    LEAVE_UNUSED("XZ", 5L),
    /** 启用 */
    START_USING("QY", 6L),
    /** 报废 */
    SCRAP("BF", 7L),
    /** 变卖 */
    REALIZE_ON("BM", 8L);

    private final String typeName;
    private final Long typeCode;

    public String getTypeName() {
        return typeName;
    }

    public Long getTypeCode() {
        return typeCode;
    }

    OrderTypeEnum(String typeName, Long typeCode) {
        this.typeName = typeName;
        this.typeCode = typeCode;
    }

    /** 验证单据类型 */
    public static boolean checkout(Long typeCode) {
        for (OrderTypeEnum typeEnum : OrderTypeEnum.values()) {
            if (typeEnum.getTypeCode().equals(typeCode)) {
                return true;
            }
        }
        return false;
    }
}
