package jnpf.model.enums;

import lombok.AllArgsConstructor;
import lombok.Getter;

@Getter
@AllArgsConstructor
public enum FormFieldType {

    SINGLE_LINE_TEXT(0, "单行文本"),

    MULTI_LINE_TEXT(1, "多行文本"),

    RADIO_BUTTON(2, "单选"),

    CHECK_BOX(3, "多选"),

    DATE(4, "日期"),

    ATTACHMENT(5, "附件"),

    IMAGE(6, "图片"),

    INTEGER(7, "整数"),

    DECIMAL(8, "小数");

    private Integer code;
    private String msg;

    public static FormFieldType fromCode(Integer code) {
        for (FormFieldType formFieldType : FormFieldType.values()) {
            if (formFieldType.getCode().equals(code)) {
                return formFieldType;
            }
        }
        return null;
    }
}
