"use strict";

Object.defineProperty(exports, "__esModule", {
  value: true
});
exports.formatPeriod = void 0;

var _getLocale = require("../../../utils/getLocale");

var _constant = require("../../../utils/constant");

var formatPeriod = function formatPeriod(selected) {
  if (!selected) return "";
  var quarter = ["", "".concat((0, _getLocale.getLocale)("OKR_MyO_Pop_1stQuarter")), "".concat((0, _getLocale.getLocale)("OKR_MyO_Pop_2ndQuarter")), "".concat((0, _getLocale.getLocale)("OKR_MyO_Pop_3rdQuarter")), "".concat((0, _getLocale.getLocale)("OKR_MyO_Pop_4thQuarter"))];
  var cycleDate = "";
  var annualNum = Number("".concat(selected.annualNum)) === -1 ? "".concat((0, _getLocale.getLocale)("OKR_MyO_Butt_Allyears")) : "".concat(selected.annualNum).concat(_getLocale.isEn ? "" : "年");
  var month = (0, _constant.getMonth)();

  switch ("".concat(selected.cycleType)) {
    case "-1":
      cycleDate = "".concat((0, _getLocale.getLocale)("OKR_MyO_Butt_AllStatee"));
      break;

    case "1":
      cycleDate = "".concat((0, _getLocale.getLocale)("OKR_MyO_Pop_Year"));
      break;

    case "2":
      // 季度
      cycleDate = quarter[Number(selected.yqmNum)];
      break;

    case "3":
      cycleDate = month[Number(selected.yqmNum) - 1];
      break;

    case "4":
      cycleDate = "".concat(month[Number(selected.yqmNum) - 1], " - ").concat(month[((Number(selected.yqmNum) + 1) % 12 || 12) - 1]);
      break;

    case "5":
      cycleDate = Number("".concat(selected.yqmNum)) === 1 ? "".concat((0, _getLocale.getLocale)("OKR_MyO_Pop_Firsthalf")) : "".concat((0, _getLocale.getLocale)("OKR_MyO_Pop_Secondhalf"));
      break;

    default:
      cycleDate = "".concat((0, _getLocale.getLocale)("Mod_Customization"));
  }

  return "".concat(annualNum, "  ").concat(cycleDate);
};

exports.formatPeriod = formatPeriod;