package com.ruoyi.project.business.enums;

import com.ruoyi.common.exception.ServiceErrorException;
import lombok.AllArgsConstructor;
import lombok.Getter;

/**
 * @author jubs
 */

@Getter
@AllArgsConstructor
public enum InputTypeEnum {
    /**
     * 字符串输入
     */
    INPUT("00", "Input"),
    /**
     * 数值输入
     */
    INPUT_NUMBER("01", "InputNumber"),
    /**
     * 下拉选择
     */
    SELECT("02", "Select"),
    /**
     * 浮点数输入框
     */
    INPUT_DECIMAL("03", "InputFloat"),

    /**
     * 可输入下拉选择
     */
    INPUT_SELECT("04", "InputSelect"),
    // CHECKBOX
    CHECK_BOX("05", "CheckBox"),
    ;

    private final String code;

    private final String desc;


    public static InputTypeEnum from(String code) {
        for (InputTypeEnum functionEnum : values()) {
            if (functionEnum.getCode().equals(code)) {
                return functionEnum;
            }
        }
        throw new ServiceErrorException("非法的参数输入类型");
    }

}
