Object.defineProperty(exports, "__esModule", { value: true });
module.exports = function (ActionAPI) {
    ActionAPI.handle(function (properties, status) {
        var connectionID = properties.connectionID != undefined ? properties.connectionID : 'none';
        if (connectionID != 'none') {
            var connection = ActionAPI.getConnection('moorentv', connectionID);
            if (connection) {
                var mtv = connection.instance;
                mtv.stopGame().then(function () {
                }).catch(function (error) {
                    status(error, 'error');
                });
            }
            else
                status("Connection doesn't exist", 'error');
        }
        else
            status('No connection specified', 'error');
    });
    ActionAPI.onOpenEditor(function (EditorAPI, properties) {
        var connectionID = properties.connectionID != undefined ? properties.connectionID : 'none';
        var connectionField = {
            id: 'connectionID',
            name: "Connection",
            type: "connection",
            connectionType: 'moorentv',
            value: connectionID
        };
        EditorAPI.setFields([connectionField]);
        EditorAPI.onFieldChanges(function (fields) {
            var fieldObject = EditorAPI.tools.objectifyFieldsValues(fields);
            EditorAPI.saveProperties({ connectionID: fieldObject.connectionID });
        });
    });
};
//# sourceMappingURL=stopGame.js.map