/**
 Copyright (C) 2010- Peter Lembke, CharZam soft
 the program is distributed under the terms of the GNU General Public License

 InfoHub is free software: you can redistribute it and/or modify
 it under the terms of the GNU General Public License as published by
 the Free Software Foundation, either version 3 of the License, or
 (at your option) any later version.

 InfoHub is distributed in the hope that it will be useful,
 but WITHOUT ANY WARRANTY; without even the implied warranty of
 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
 GNU General Public License for more details.

 You should have received a copy of the GNU General Public License
 along with InfoHub.  If not, see <https://www.gnu.org/licenses/>.'
 */
function infohub_translate_menu() {

    'use strict';

// include "infohub_base.js"

    const _Version = function() {
        return {
            'date': '2021-09-09',
            'since': '2019-09-27',
            'version': '1.0.1',
            'checksum': '{{checksum}}',
            'class_name': 'infohub_translate_menu',
            'note': 'Render a menu for infohub_translate',
            'status': 'normal',
            'SPDX-License-Identifier': 'GPL-3.0-or-later',
        };
    };

    const _GetCmdFunctions = function() {
        const $list = {
            'create': 'normal',
        };

        return _GetCmdFunctionsBase($list);
    };

    let $classTranslations = {};

    // ***********************************************************
    // * your class functions below, only declare with var
    // * Can only be reached through cmd()
    // ***********************************************************

    /**
     * Get instructions and create the message to InfoHub View
     * @version 2016-10-16
     * @since   2016-10-16
     * @author  Peter Lembke
     */
    $functions.push('create');
    const create = function($in = {}) {
        const $default = {
            'subtype': 'menu',
            'parent_box_id': '',
            'translations': {},
            'step': 'step_start',
            'response': {
                'answer': 'false',
                'message': 'Nothing to report from translate_encrypt',
            },
        };
        $in = _Default($default, $in);

        if ($in.step === 'step_start') {
            $classTranslations = $in.translations;
            return _SubCall({
                'to': {
                    'node': 'client',
                    'plugin': 'infohub_render',
                    'function': 'create',
                },
                'data': {
                    'what': {
                        'titel': {
                            'type': 'common',
                            'subtype': 'value',
                            'data': _Translate('TRANSLATION_TOOL')
                        },
                        'my_menu': {
                            'plugin': 'infohub_rendermenu',
                            'type': 'menu',
                            'head_label': '[titel]',
                            'options': {
                                'doc': {
                                    'alias': 'doc_link',
                                    'event_data': 'doc',
                                    'button_label': _Translate('DOCUMENTATION'),
                                    'to_plugin': 'infohub_translate',
                                    'to_function': 'click_menu'
                                },
                                'updateplugin': {
                                    'alias': 'updateplugin_link',
                                    'event_data': 'updateplugin',
                                    'button_label': _Translate('UPDATE_PLUGIN_KEYS'),
                                    'to_plugin': 'infohub_translate',
                                    'to_function': 'click_menu'
                                },
                                'createfile': {
                                    'alias': 'createfile_link',
                                    'event_data': 'createfile',
                                    'button_label': _Translate('CREATE_A_TRANSLATION_FILE'),
                                    'to_plugin': 'infohub_translate',
                                    'to_function': 'click_menu'
                                },
                                'validate': {
                                    'alias': 'validate_link',
                                    'event_data': 'validate',
                                    'button_label': _Translate('VALIDATE_TRANSLATION_FILES'),
                                    'to_plugin': 'infohub_translate',
                                    'to_function': 'click_menu'
                                }
                            },
                        },
                    },
                    'how': {
                        'mode': 'one box',
                        'text': '[my_menu]',
                    },
                    'where': {
                        'box_id': $in.parent_box_id + '.menu',
                        'max_width': 320,
                        'scroll_to_box_id': 'true',
                    },
                    'cache_key': 'menu',
                },
                'data_back': {
                    'step': 'step_end',
                },
            });
        }

        return {
            'answer': $in.response.answer,
            'message': $in.response.message,
        };
    };
}
//# sourceURL=infohub_translate_menu.js