"use strict";

Object.defineProperty(exports, "__esModule", {
  value: true
});
exports.transProgress = exports.getOptions = exports.getOSetting = exports.getKrSetting = exports.getKrOptions = void 0;

var _react = _interopRequireDefault(require("react"));

var _util = require("../../../../util");

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

var getOSetting = function getOSetting() {
  return {
    settingTitle: (0, _util.getLocale)("OKR_MyO_Pop_Upd_Setmatically"),
    switchLabel: (0, _util.getLocale)("OKR_MyO_Pop_Upd_Setmatically"),
    options: [{
      label: (0, _util.getLocale)("OKR_MyO_Pop_Upd_Autup"),
      key: 1,
      tooltip: (0, _util.getLocale)("OKR_MyO_Pop_Upd_KRCompletion")
    }, {
      label: (0, _util.getLocale)("OKR_MyO_Pop_Upd_Autcom"),
      key: 2,
      tooltip: (0, _util.getLocale)("OKR_MyO_Pop_Upd_SubO")
    }],
    getRecommandText: function getRecommandText() {
      var autoUpdate = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : true;
      var updateWay = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : 1;
      var recommandProgressObj = arguments.length > 2 ? arguments[2] : undefined;

      if (autoUpdate) {
        if (updateWay == 1) return (0, _util.getLocale)("OKR_MyO_Pop_Upd_Automatic");
        if (updateWay == 2) return (0, _util.getLocale)("OKR_MyO_calculationSubO");
      } else {
        var childOkrProgress = recommandProgressObj.childOkrProgress,
            childkrProgress = recommandProgressObj.childkrProgress;
        var textArr = [];
        childkrProgress !== -1 && textArr.push("KR\u5B8C\u6210\u5EA6".concat(childkrProgress || 0, "%"));
        childOkrProgress !== -1 && textArr.push("".concat((0, _util.getLocale)("OKR_MyO_Ew_SubobjCom")).concat(childOkrProgress || 0, "%"));
        if (textArr.length == 0) return "";
        return (0, _util.getLocale)("Per_Ass_Pop_title_Recommend") + textArr.join("，");
      }
    }
  };
};

exports.getOSetting = getOSetting;

var getKrSetting = function getKrSetting() {
  return {
    settingTitle: (0, _util.getLocale)("OKR_MyO_KRCompletion"),
    switchLabel: (0, _util.getLocale)("OKR_MyO_SetKRcompletion"),
    options: [{
      label: (0, _util.getLocale)("OKR_MyO_Updatetask"),
      key: 1,
      tooltip: (0, _util.getLocale)("OKR_MyO_AeKRcompletionde")
    }, {
      label: (0, _util.getLocale)("OKR_MyO_Pop_Upd_Autcom"),
      key: 2,
      tooltip: (0, _util.getLocale)("OKR_MyO_KRcompletionde")
    }],
    getRecommandText: function getRecommandText() {
      var autoUpdate = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : true;
      var updateWay = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : 1;
      var recommandProgressObj = arguments.length > 2 ? arguments[2] : undefined;

      if (autoUpdate) {
        if (updateWay === 1) return (0, _util.getLocale)("OKR_MyO_Automatic");
        if (updateWay === 2) return (0, _util.getLocale)("OKR_MyO_calculationSubO");
        return /*#__PURE__*/_react["default"].createElement("span", null);
      }

      var childOkrProgress = recommandProgressObj.childOkrProgress,
          childEProgress = recommandProgressObj.childEProgress;
      var textArr = [];

      if (childEProgress !== -1) {
        textArr.push("".concat((0, _util.getLocale)("OKR_MyO_Ecompletion")).concat(childEProgress || 0).concat((0, _util.getLocale)("OKR_MyO_Pop_Upd_Percentage")));
      }

      if (childOkrProgress !== -1) {
        textArr.push("".concat((0, _util.getLocale)("OKR_MyO_Ew_SubobjCom")).concat(childOkrProgress || 0).concat((0, _util.getLocale)("OKR_MyO_Pop_Upd_Percentage")));
      }

      if (textArr.length === 0) return "";
      return (0, _util.getLocale)("Per_Ass_Pop_title_Recommend") + textArr.join("，");
    }
  };
};

exports.getKrSetting = getKrSetting;

var transProgress = function transProgress(progress) {
  return progress === -1 ? 0 : progress;
};

exports.transProgress = transProgress;

var getKrOptions = function getKrOptions() {
  return [{
    id: 1,
    color: "#2879ff",
    text: (0, _util.getLocale)("OKR_MyO_Pop_Upd_Notrack")
  }, {
    id: 2,
    color: "#F6BD16",
    text: (0, _util.getLocale)("OKR_MyO_Pop_Upd_Atrisk")
  }, {
    id: 3,
    color: "#F05E5E",
    text: (0, _util.getLocale)("OKR_MyO_Pop_Upd_Postoned")
  }];
};

exports.getKrOptions = getKrOptions;

var getOptions = function getOptions() {
  return [{
    id: 6,
    color: "#2879ff",
    text: (0, _util.getLocale)("OKR_MyO_Pop_Upd_Notrack")
  }, {
    id: 2,
    color: "#F6BD16",
    text: (0, _util.getLocale)("OKR_MyO_Pop_Upd_Atrisk")
  }, {
    id: 3,
    color: "#F05E5E",
    text: (0, _util.getLocale)("OKR_MyO_Pop_Upd_Postoned")
  }];
};

exports.getOptions = getOptions;