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' && connectionID.length > 0) {
            var connection = ActionAPI.getConnection('wirecast-bridge', connectionID);
            if (connection && connection.instance) {
                connection.instance
                    .go()
                    .then(function () {
                    status('Go!', 'info');
                })
                    .catch(function (error) {
                    status(error, '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: 'wirecast-bridge',
            value: connectionID
        };
        EditorAPI.onFieldChanges(function (fields) {
            var fieldObject = EditorAPI.tools.objectifyFieldsValues(fields);
            EditorAPI.saveProperties({ connectionID: fieldObject.connectionID });
        });
        EditorAPI.setFields([
            connectionField
        ]);
    });
};
//# sourceMappingURL=go.js.map