"use strict";
Object.defineProperty(exports, "__esModule", { value: true });
const config_adapter_1 = require("../config-adapter");
function TextComponentAdapter(input) {
    const type = input.accessor.value('GUI_renderType', 'string');
    const { accessor, variable, extraOptions } = input;
    let textComponent = {
        editable: extraOptions.editable,
        type: 'VariableText',
        unit: input.variable.unit,
        variable: `${input.variable.name}`,
        digitsInfo: config_adapter_1.extractDigitsInfo(input.variableConfig),
        valueFontSize: input.accessor.value('GUI_valueFontSize', 'string', undefined),
        valueFormatting: input.accessor.value('GUI_valueFormatting', 'string', undefined),
        inputOptions: {
            min: input.accessor.value('GUI_min', 'number', undefined),
            max: input.accessor.value('GUI_max', 'number', undefined)
        }
    };
    switch (type) {
        case 'Select':
            let selectActions = config_adapter_1.parseSelectOptions(accessor.value('GUI_listChoices', 'string', ''));
            textComponent.inputOptions = {
                type: 'select',
                options: selectActions
            };
            break;
        case 'Password':
            textComponent.inputOptions = {
                type: 'password'
            };
    }
    return textComponent;
}
exports.default = TextComponentAdapter;
//# sourceMappingURL=TextAdapter.js.map