'use strict';

Object.defineProperty(exports, "__esModule", {
    value: true
});
exports.ExecutorLaunchDarkly = undefined;

var _regenerator = require('babel-runtime/regenerator');

var _regenerator2 = _interopRequireDefault(_regenerator);

var _asyncToGenerator2 = require('babel-runtime/helpers/asyncToGenerator');

var _asyncToGenerator3 = _interopRequireDefault(_asyncToGenerator2);

var _getPrototypeOf = require('babel-runtime/core-js/object/get-prototype-of');

var _getPrototypeOf2 = _interopRequireDefault(_getPrototypeOf);

var _classCallCheck2 = require('babel-runtime/helpers/classCallCheck');

var _classCallCheck3 = _interopRequireDefault(_classCallCheck2);

var _createClass2 = require('babel-runtime/helpers/createClass');

var _createClass3 = _interopRequireDefault(_createClass2);

var _possibleConstructorReturn2 = require('babel-runtime/helpers/possibleConstructorReturn');

var _possibleConstructorReturn3 = _interopRequireDefault(_possibleConstructorReturn2);

var _inherits2 = require('babel-runtime/helpers/inherits');

var _inherits3 = _interopRequireDefault(_inherits2);

var _Executor2 = require('../agent/Executor');

var _AgentUtils = require('../agent/AgentUtils');

function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }

var log = _AgentUtils.AgentUtils.logger();

/**
 * Sample .githubTaskManager.json task config
 *
 * see: https://github.com/wyvern8/github-task-manager/wiki/Structure-of-.githubTaskManager.json
 *
 * {
        "executor": "LaunchDarkly",
        "context": "Set FeatureFlags",
        "options": {
          "flags": {
            "testFlagOne": true,
            "testFlagTwo": false
          }
        }
      }
 */

var ExecutorLaunchDarkly = exports.ExecutorLaunchDarkly = function (_Executor) {
    (0, _inherits3.default)(ExecutorLaunchDarkly, _Executor);

    function ExecutorLaunchDarkly(eventData) {
        (0, _classCallCheck3.default)(this, ExecutorLaunchDarkly);

        var _this = (0, _possibleConstructorReturn3.default)(this, (ExecutorLaunchDarkly.__proto__ || (0, _getPrototypeOf2.default)(ExecutorLaunchDarkly)).call(this, eventData));

        _this.options = _this.getOptions();
        return _this;
    }

    (0, _createClass3.default)(ExecutorLaunchDarkly, [{
        key: 'executeTask',
        value: function () {
            var _ref = (0, _asyncToGenerator3.default)( /*#__PURE__*/_regenerator2.default.mark(function _callee(task) {
                return _regenerator2.default.wrap(function _callee$(_context) {
                    while (1) {
                        switch (_context.prev = _context.next) {
                            case 0:
                                log.info('Starting LaunchDarkly api calls. Flags: ' + task.options.flags);

                                //do it

                            case 1:
                            case 'end':
                                return _context.stop();
                        }
                    }
                }, _callee, this);
            }));

            function executeTask(_x) {
                return _ref.apply(this, arguments);
            }

            return executeTask;
        }()
    }]);
    return ExecutorLaunchDarkly;
}(_Executor2.Executor);

_Executor2.Executor.register('LaunchDarkly', ExecutorLaunchDarkly);