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

function _defineProperties(target, props) { for (var i = 0; i < props.length; i++) { var descriptor = props[i]; descriptor.enumerable = descriptor.enumerable || false; descriptor.configurable = true; if ("value" in descriptor) descriptor.writable = true; Object.defineProperty(target, descriptor.key, descriptor); } }

function _createClass(Constructor, protoProps, staticProps) { if (protoProps) _defineProperties(Constructor.prototype, protoProps); if (staticProps) _defineProperties(Constructor, staticProps); return Constructor; }

function getApiUrl(organizationId) {
  return organizationId ? "/devops/v1/app_template/organization/".concat(organizationId) : '/devops/v1/app_template/site';
}

var TemplateApis = /*#__PURE__*/function () {
  function TemplateApis() {
    _classCallCheck(this, TemplateApis);
  }

  _createClass(TemplateApis, null, [{
    key: "getTemplateTable",
    value: function getTemplateTable(organizationId) {
      return "".concat(getApiUrl(organizationId));
    }
  }, {
    key: "templateEnabled",
    value: function templateEnabled(templateId, type, organizationId) {
      return "".concat(getApiUrl(organizationId), "/").concat(type, "/").concat(templateId);
    }
  }, {
    key: "deleteTemplate",
    value: function deleteTemplate(templateId, organizationId) {
      return "".concat(getApiUrl(organizationId), "/").concat(templateId);
    }
  }, {
    key: "getTemplateDetail",
    value: function getTemplateDetail(templateId, organizationId) {
      return "".concat(getApiUrl(organizationId), "/").concat(templateId);
    }
  }, {
    key: "getTemplateList",
    value: function getTemplateList(randomString) {
      return "".concat(getApiUrl(), "/list?randomString=").concat(randomString);
    }
  }, {
    key: "getOrgTemplateList",
    value: function getOrgTemplateList(type, organizationId, randomString) {
      return "".concat(getApiUrl(organizationId), "/list?selectedLevel=").concat(type, "&randomString=").concat(randomString);
    }
  }, {
    key: "checkTemplateNameOrCode",
    value: function checkTemplateNameOrCode(_ref) {
      var type = _ref.type,
          value = _ref.value,
          templateId = _ref.templateId,
          organizationId = _ref.organizationId;
      return "".concat(getApiUrl(organizationId), "/check_name_or_code?type=").concat(type, "&value=").concat(value).concat(templateId ? "&app_template_id=".concat(templateId) : '');
    }
  }, {
    key: "createTemplate",
    value: function createTemplate(organizationId) {
      return "".concat(getApiUrl(organizationId), "/create_template");
    }
  }, {
    key: "updateTemplateName",
    value: function updateTemplateName(templateId, name, organizationId) {
      return "".concat(getApiUrl(organizationId), "/").concat(templateId, "?name=").concat(name);
    }
  }, {
    key: "addTemplatePermission",
    value: function addTemplatePermission(templateId, organizationId) {
      return "".concat(getApiUrl(organizationId), "/add_permission/").concat(templateId);
    }
  }]);

  return TemplateApis;
}();

export { TemplateApis as default };