package cn.iocoder.yudao.module.system.enums.device;

import cn.hutool.core.util.ArrayUtil;
import cn.iocoder.yudao.framework.common.core.ArrayValuable;
import lombok.AllArgsConstructor;
import lombok.Getter;

import java.util.Arrays;

/**
 * Bpm 设备类型
 *
 * @author jinyd
 */
@AllArgsConstructor
@Getter
public enum DeviceModelTypeEnum implements ArrayValuable<Integer> {

    HEALTH(0, "elderly_vital_signs"),
    MONITOR(1, ""),
    SLEEP(2, "sleep_report"),
    FALL(3, "fall_report"),
    SECURITY(4, ""),
    WRIST_WATCH(5, ""),
    ENVIRONMENT(6, "");

    public static final Integer[] ARRAYS = Arrays.stream(values()).map(DeviceModelTypeEnum::getType).toArray(Integer[]::new);

    /**
     * 类型
     */
    private final Integer type;
    /**
     * 转改名
     */
    private final String tableNmae;

    public static DeviceModelTypeEnum valueOf(Integer value) {
        return ArrayUtil.firstMatch(businessType -> businessType.getType().equals(value), DeviceModelTypeEnum.values());
    }

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

}
