"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(annualNum, " ").concat((0, _getLocale.getLocale)("OKR_MyO_Butt_AllStatee"));
      break;

    case "1":
      if (Number(selected.annualNum) === 0) {
        cycleDate = '';
      } else {
        cycleDate = "".concat(annualNum, " ").concat((0, _getLocale.getLocale)("OKR_MyO_Pop_Year"));
      }

      break;

    case "2":
      // 季度
      if (Number(selected.annualNum) === 0 || Number(selected.yqmNum) === 0) {
        cycleDate = '';
      } else {
        cycleDate = "".concat(annualNum, " ").concat(quarter[Number(selected.yqmNum)]);
      }

      break;

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

    case "4":
      if (Number(selected.annualNum) === 0) {
        cycleDate = '';
      } else {
        cycleDate = "".concat(annualNum, " ").concat(month[Number(selected.yqmNum) - 1], " - ").concat(month[((Number(selected.yqmNum) + 1) % 12 || 12) - 1]);
      }

      break;

    case "5":
      if (Number(selected.annualNum) === 0) {
        cycleDate = '';
      } else {
        cycleDate = Number("".concat(selected.yqmNum)) === 1 ? "".concat(annualNum, " ").concat((0, _getLocale.getLocale)("OKR_MyO_Pop_Firsthalf")) : "".concat(annualNum, " ").concat((0, _getLocale.getLocale)("OKR_MyO_Pop_Secondhalf"));
      }

      break;

    case '0':
      if (Number(selected.annualNum) === 0 && Number(selected.yqmNum) === 0 && !selected.startDate && !selected.endDate) {
        cycleDate = '';
      } else {
        cycleDate = "".concat((0, _getLocale.getLocale)('Mod_Customization'));
      }

      break;

    default:
      cycleDate = '';
  }

  return "".concat(cycleDate);
};

exports.formatPeriod = formatPeriod;