function _classCallCheck(a, n) { if (!(a instanceof n)) throw new TypeError("Cannot call a class as a function"); }

function _defineProperties(e, r) { for (var t = 0; t < r.length; t++) { var o = r[t]; o.enumerable = o.enumerable || !1, o.configurable = !0, "value" in o && (o.writable = !0), Object.defineProperty(e, _toPropertyKey(o.key), o); } }

function _createClass(e, r, t) { return r && _defineProperties(e.prototype, r), t && _defineProperties(e, t), Object.defineProperty(e, "prototype", { writable: !1 }), e; }

function _toPropertyKey(t) { var i = _toPrimitive(t, "string"); return "symbol" == typeof i ? i : i + ""; }

function _toPrimitive(t, r) { if ("object" != typeof t || !t) return t; var e = t[Symbol.toPrimitive]; if (void 0 !== e) { var i = e.call(t, r || "default"); if ("object" != typeof i) return i; throw new TypeError("@@toPrimitive must return a primitive value."); } return ("string" === r ? String : Number)(t); }

(window["webpackJsonp"] = window["webpackJsonp"] || []).push([["default~add-test-suite-add-test-suite-module~test-case-configuration-test-case-configuration-module"], {
  /***/
  "./src/app/pages/home/load-test/testsuite/services/testsuite-data-handler.service.ts":
  /*!*******************************************************************************************!*\
    !*** ./src/app/pages/home/load-test/testsuite/services/testsuite-data-handler.service.ts ***!
    \*******************************************************************************************/

  /*! exports provided: TestsuiteDataHandlerService */

  /***/
  function _src_app_pages_home_loadTest_testsuite_services_testsuiteDataHandlerServiceTs(module, __webpack_exports__, __webpack_require__) {
    "use strict";

    __webpack_require__.r(__webpack_exports__);
    /* harmony export (binding) */


    __webpack_require__.d(__webpack_exports__, "TestsuiteDataHandlerService", function () {
      return TestsuiteDataHandlerService;
    });
    /* harmony import */


    var tslib__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(
    /*! tslib */
    "./node_modules/tslib/tslib.es6.js");
    /* harmony import */


    var _angular_core__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(
    /*! @angular/core */
    "./node_modules/@angular/core/__ivy_ngcc__/fesm2015/core.js");
    /* harmony import */


    var _testsuite_config_service__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(
    /*! ./testsuite-config.service */
    "./src/app/pages/home/load-test/testsuite/services/testsuite-config.service.ts");
    /* harmony import */


    var _testsuite_http_service__WEBPACK_IMPORTED_MODULE_3__ = __webpack_require__(
    /*! ./testsuite-http.service */
    "./src/app/pages/home/load-test/testsuite/services/testsuite-http.service.ts");
    /* harmony import */


    var _testsuite_state__WEBPACK_IMPORTED_MODULE_4__ = __webpack_require__(
    /*! ./testsuite.state */
    "./src/app/pages/home/load-test/testsuite/services/testsuite.state.ts");
    /* harmony import */


    var src_app_core_session_session_service__WEBPACK_IMPORTED_MODULE_5__ = __webpack_require__(
    /*! src/app/core/session/session.service */
    "./src/app/core/session/session.service.ts");

    var TestsuiteDataHandlerService = /*#__PURE__*/function () {
      function TestsuiteDataHandlerService(_testConfig, testsuiteHTTPService, sessionservice) {
        _classCallCheck(this, TestsuiteDataHandlerService);

        this._testConfig = _testConfig;
        this.testsuiteHTTPService = testsuiteHTTPService;
        this.sessionservice = sessionservice;
        this.list = new Array();
      }

      return _createClass(TestsuiteDataHandlerService, [{
        key: "getScenarioList",
        value: function getScenarioList(arg) {
          var _this = this;

          try {
            var username = this.sessionservice.session.cctx.u;
            var param = "&projSubproj=" + arg;
            this.testsuiteHTTPService.getScenarioListForSpecificProjSubProj(param).subscribe(function (state) {
              if (state instanceof _testsuite_state__WEBPACK_IMPORTED_MODULE_4__["GetScenarioListForSpeProSubProLoadingState"]) {
                _this.onLoadingGetScenarioList(state);

                return;
              }

              if (state instanceof _testsuite_state__WEBPACK_IMPORTED_MODULE_4__["GetScenarioListForSpeProSubProLoadedState"]) {
                _this.onLoadedGetScenarioList(state);

                return;
              }
            }, function (state) {
              _this.onLoadingErrorGetScenarioList(state);
            });
          } catch (e) {
            console.error(e);
          }
        }
      }, {
        key: "onLoadingGetScenarioList",
        value: function onLoadingGetScenarioList(state) {}
      }, {
        key: "onLoadedGetScenarioList",
        value: function onLoadedGetScenarioList(state) {
          this.updateScenario(state.data);
        }
      }, {
        key: "onLoadingErrorGetScenarioList",
        value: function onLoadingErrorGetScenarioList(state) {}
      }, {
        key: "updateScenario",
        value: function updateScenario(data) {
          this._testConfig.updateScenarioList(data);
        }
      }, {
        key: "getCheckScriptData",
        value: function getCheckScriptData(project, subProject, testCaseName) {
          var _this2 = this;

          try {
            var username = this.sessionservice.session.cctx.u;
            var projectSubproject = project + "/" + subProject;
            var param = "&projectSubProject=" + projectSubproject + "&testCaseName=" + testCaseName;
            this.testsuiteHTTPService.getCheckScriptData(param).subscribe(function (state) {
              if (state instanceof _testsuite_state__WEBPACK_IMPORTED_MODULE_4__["GetCheckScriptDataLoadingState"]) {
                _this2.onLoadingGetCheckScriptData(state);

                return;
              }

              if (state instanceof _testsuite_state__WEBPACK_IMPORTED_MODULE_4__["GetCheckScriptDataLoadedState"]) {
                _this2.onLoadedGetCheckScriptData(state);

                return;
              }
            }, function (state) {
              _this2.onLoadingErrorGetCheckScriptData(state);
            });
          } catch (e) {
            console.error(e);
          }
        }
      }, {
        key: "onLoadingGetCheckScriptData",
        value: function onLoadingGetCheckScriptData(state) {}
      }, {
        key: "onLoadedGetCheckScriptData",
        value: function onLoadedGetCheckScriptData(state) {
          this.getChkScrtData(state.data);
        }
      }, {
        key: "onLoadingErrorGetCheckScriptData",
        value: function onLoadingErrorGetCheckScriptData(state) {}
      }, {
        key: "getChkScrtData",
        value: function getChkScrtData(response) {
          console.log("response of getCheckScriptData =", response);

          this._testConfig.updateCheckScriptData(response);
        }
      }, {
        key: "saveSelectedCheckProfile",
        value: function saveSelectedCheckProfile(project, subProject, testCaseName, checkStatusData) {
          var _this3 = this;

          try {
            var username = this.sessionservice.session.cctx.u;
            var projectSubproject = project + "/" + subProject;
            var param = "&projectSubProject=" + projectSubproject + "&testCaseName=" + testCaseName;
            this.testsuiteHTTPService.getCheckScriptData(param).subscribe(function (state) {
              if (state instanceof _testsuite_state__WEBPACK_IMPORTED_MODULE_4__["GetCheckScriptDataLoadingState"]) {
                _this3.onLoadingGetCheckScriptData(state);

                return;
              }

              if (state instanceof _testsuite_state__WEBPACK_IMPORTED_MODULE_4__["GetCheckScriptDataLoadedState"]) {
                _this3.onLoadedSaveCheckProfData(state, checkStatusData);

                return;
              }
            }, function (state) {
              _this3.onLoadingErrorGetCheckScriptData(state);
            });
          } catch (e) {
            console.error(e);
          }
        }
      }, {
        key: "onLoadedSaveCheckProfData",
        value: function onLoadedSaveCheckProfData(state, checkstatusdata) {
          this.saveCheckProfData(state.data, checkstatusdata);
        }
      }, {
        key: "saveCheckProfData",
        value: function saveCheckProfData(response, checkStatusData) {
          console.log("response of saveSelectedCheckProfile =", response.checkStatusBufferData);
          response.checkStatusBufferData = checkStatusData + "\n" + " ";
          console.log("final ==========", response);

          this._testConfig.updateSelectedCheckProfile(response);
        }
      }, {
        key: "saveTestCaseData",
        value: function saveTestCaseData(actualTestCaseName, testCaseName) {
          var _this4 = this;

          try {
            console.log("Inside saveTestCaseData method");
            var username = this.sessionservice.session.cctx.u;

            var testCaseData = this._testConfig.getTestCaseData();

            testCaseName = this._testConfig.$projectSubProject + "/" + testCaseName;
            var param = '&testCaseName=' + actualTestCaseName + '&newTestCaseName=' + testCaseName;
            this.testsuiteHTTPService.saveTestCaseData(param, testCaseData).subscribe(function (state) {
              if (state instanceof _testsuite_state__WEBPACK_IMPORTED_MODULE_4__["SaveTestCaseDataLoadingState"]) {
                _this4.onLoadingSaveData(state);

                return;
              }

              if (state instanceof _testsuite_state__WEBPACK_IMPORTED_MODULE_4__["SaveTestCaseDataLoadedState"]) {
                _this4.onLoadedSaveData(state);

                return;
              }
            }, function (state) {
              _this4.onLoadingErrorSaveData(state);
            });
          } catch (e) {
            console.error(e);
          }
        }
      }, {
        key: "onLoadingSaveData",
        value: function onLoadingSaveData(state) {}
      }, {
        key: "onLoadedSaveData",
        value: function onLoadedSaveData(state) {
          this.saveData(state.data);
        }
      }, {
        key: "onLoadingErrorSaveData",
        value: function onLoadingErrorSaveData(state) {}
      }, {
        key: "saveData",
        value: function saveData(result) {
          if (result) {
            var saveTestCase = result;
            if (saveTestCase['Message'] == "File") alert('Configuration saved successfully.');
          } else {
            alert("Configuration not saved successfully.");
          }
        }
      }, {
        key: "getServerList",
        value: function getServerList() {
          var _this5 = this;

          try {
            this.testsuiteHTTPService.getServerList().subscribe(function (state) {
              if (state instanceof _testsuite_state__WEBPACK_IMPORTED_MODULE_4__["GetServerListLoadingState"]) {
                _this5.onLoadingGetServerList(state);

                return;
              }

              if (state instanceof _testsuite_state__WEBPACK_IMPORTED_MODULE_4__["GetServerListLoadedState"]) {
                _this5.onLoadedGetServerList(state);

                return;
              }
            }, function (state) {
              _this5.onLoadingErrorGetServerList(state);
            });
          } catch (e) {
            console.error(e);
          }
        }
      }, {
        key: "onLoadingGetServerList",
        value: function onLoadingGetServerList(state) {}
      }, {
        key: "onLoadedGetServerList",
        value: function onLoadedGetServerList(state) {
          this.getserver(state.data);
        }
      }, {
        key: "onLoadingErrorGetServerList",
        value: function onLoadingErrorGetServerList(state) {}
      }, {
        key: "getserver",
        value: function getserver(response) {
          this._testConfig.updateServerList(response);
        }
      }, {
        key: "getSavedIterations",
        value: function getSavedIterations(project, subProject, testCaseName) {
          var _this6 = this;

          try {
            var username = this.sessionservice.session.cctx.u;
            var param = "&projSubproject=" + project + "/" + subProject + "&testCaseName=" + testCaseName;
            this.testsuiteHTTPService.getIterations(param).subscribe(function (state) {
              if (state instanceof _testsuite_state__WEBPACK_IMPORTED_MODULE_4__["GetIterationsLoadingState"]) {
                _this6.onLoadingGetIteration(state);

                return;
              }

              if (state instanceof _testsuite_state__WEBPACK_IMPORTED_MODULE_4__["GetIterationsLoadedState"]) {
                _this6.onLoadedGetIteration(state);

                return;
              }
            }, function (state) {
              _this6.onLoadingErrorGetIteration(state);
            });
          } catch (e) {
            console.error(e);
          }
        }
      }, {
        key: "onLoadingGetIteration",
        value: function onLoadingGetIteration(state) {}
      }, {
        key: "onLoadedGetIteration",
        value: function onLoadedGetIteration(state) {
          this.getIteration(state.data);
        }
      }, {
        key: "onLoadingErrorGetIteration",
        value: function onLoadingErrorGetIteration(state) {}
      }, {
        key: "getIteration",
        value: function getIteration(result) {
          var data = result;

          if (data) {
            this._testConfig.updateIterationList(data);
          }
        }
      }, {
        key: "getSavedMailConfiguration",
        value: function getSavedMailConfiguration(project, subProject, testCaseName) {
          var _this7 = this;

          return new Promise(function (onfullfill, onreject) {
            try {
              var username = _this7.sessionservice.session.cctx.u;
              var param = "&projSubproject=" + project + "/" + subProject + "&testCaseName=" + testCaseName;

              _this7.testsuiteHTTPService.getMailConfig(param).subscribe(function (state) {
                if (state instanceof _testsuite_state__WEBPACK_IMPORTED_MODULE_4__["GetMailConfigLoadingState"]) {
                  _this7.onLoadingGetMail(state);

                  return;
                }

                if (state instanceof _testsuite_state__WEBPACK_IMPORTED_MODULE_4__["GetMailConfigLoadedState"]) {
                  _this7.onLoadedGetmail(state);

                  onfullfill(true);
                  return;
                }
              }, function (state) {
                _this7.onLoadingErrorGetmail(state);

                onfullfill(false);
              });
            } catch (e) {
              console.error(e);
              onfullfill(false);
            }
          });
        }
      }, {
        key: "onLoadingGetMail",
        value: function onLoadingGetMail(state) {}
      }, {
        key: "onLoadedGetmail",
        value: function onLoadedGetmail(state) {
          this.getMail(state.data);
        }
      }, {
        key: "onLoadingErrorGetmail",
        value: function onLoadingErrorGetmail(state) {}
      }, {
        key: "getMail",
        value: function getMail(result) {
          var data = result;

          if (data) {
            this._testConfig.updateMailConfiguration(data);
          }
        }
      }, {
        key: "getSavedPrePostList",
        value: function getSavedPrePostList(project, subProject, testCaseName) {
          var _this8 = this;

          try {
            var username = this.sessionservice.session.cctx.u;
            var param = "&projSubproject=" + project + "/" + subProject + "&testCaseName=" + testCaseName;

            var data = this._testConfig.getSelectedRowForTestCase();

            this.testsuiteHTTPService.getActions(param).subscribe(function (state) {
              if (state instanceof _testsuite_state__WEBPACK_IMPORTED_MODULE_4__["GetActionsLoadingState"]) {
                _this8.onLoadingGetPrePostdata(state);

                return;
              }

              if (state instanceof _testsuite_state__WEBPACK_IMPORTED_MODULE_4__["GetActionsLoadedState"]) {
                _this8.onLoadedGetPrePostdata(state);

                return;
              }
            }, function (state) {
              _this8.onLoadingErrorGetPrePostdata(state);
            });
          } catch (e) {
            console.error(e);
          }
        }
      }, {
        key: "onLoadingGetPrePostdata",
        value: function onLoadingGetPrePostdata(state) {}
      }, {
        key: "onLoadedGetPrePostdata",
        value: function onLoadedGetPrePostdata(state) {
          this.getPrePostData(state.data);
        }
      }, {
        key: "onLoadingErrorGetPrePostdata",
        value: function onLoadingErrorGetPrePostdata(state) {}
      }, {
        key: "getPrePostData",
        value: function getPrePostData(result) {
          this._testConfig.updatePreList(result);
        }
      }, {
        key: "getMailSMSSetting",
        value: function getMailSMSSetting() {
          var _this9 = this;

          try {
            var payload = {
              cctx: this.sessionservice.session.cctx
            };
            this.testsuiteHTTPService.getMailIsEnable(payload).subscribe(function (state) {
              if (state instanceof _testsuite_state__WEBPACK_IMPORTED_MODULE_4__["MailSMSSettingLoadingState"]) {
                _this9.onLoadingMailConfdata(state);

                return;
              }

              if (state instanceof _testsuite_state__WEBPACK_IMPORTED_MODULE_4__["MailSMSSettingLoadedState"]) {
                _this9.onLoadedMailConfdata(state);

                return;
              }
            }, function (state) {
              _this9.onLoadingErrorMailConfdata(state);
            });
          } catch (e) {
            console.error(e);
          }
        }
      }, {
        key: "onLoadingMailConfdata",
        value: function onLoadingMailConfdata(state) {}
      }, {
        key: "onLoadedMailConfdata",
        value: function onLoadedMailConfdata(state) {
          this._testConfig.updateMailConf(state.data);
        }
      }, {
        key: "onLoadingErrorMailConfdata",
        value: function onLoadingErrorMailConfdata(state) {}
      }]);
    }();

    TestsuiteDataHandlerService.ctorParameters = function () {
      return [{
        type: _testsuite_config_service__WEBPACK_IMPORTED_MODULE_2__["TestsuiteConfigService"]
      }, {
        type: _testsuite_http_service__WEBPACK_IMPORTED_MODULE_3__["TestsuiteHttpService"]
      }, {
        type: src_app_core_session_session_service__WEBPACK_IMPORTED_MODULE_5__["SessionService"]
      }];
    };

    TestsuiteDataHandlerService = Object(tslib__WEBPACK_IMPORTED_MODULE_0__["__decorate"])([Object(_angular_core__WEBPACK_IMPORTED_MODULE_1__["Injectable"])({
      providedIn: 'root'
    })], TestsuiteDataHandlerService);
    /***/
  }
}]);