"use strict";

Object.defineProperty(exports, "__esModule", {
  value: true
});
exports.updateTaskStatus = exports.updateTaskPrincipal = exports.updateTaskDate = exports.setTaskPriority = exports.cancelRel = void 0;

var _qs = _interopRequireDefault(require("qs"));

var _request = require("../../utils/request");

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

var updateTaskPrincipal = function updateTaskPrincipal(_ref) {
  var taskId = _ref.taskId,
      toUserId = _ref.toUserId;
  return (0, _request.rpost)("v1")("task/UpdatePrincipal", {
    task_id: taskId,
    to_user_id: toUserId
  }, {
    headers: {
      "Content-Type": "application/x-www-form-urlencoded"
    },
    transformRequest: _qs["default"].stringify
  });
};

exports.updateTaskPrincipal = updateTaskPrincipal;

var updateTaskDate = function updateTaskDate(_ref2) {
  var taskId = _ref2.taskId,
      endDate = _ref2.endDate,
      startDate = _ref2.startDate,
      isLongTerm = _ref2.isLongTerm;
  return (0, _request.rpost)("v1")("task/UpdateTaskDate?task_id=".concat(taskId), {
    task_id: taskId,
    Deadline: endDate,
    StartDate: startDate,
    IsLongTerm: isLongTerm
  }, {
    headers: {
      "Content-Type": "application/x-www-form-urlencoded"
    },
    transformRequest: _qs["default"].stringify
  });
};

exports.updateTaskDate = updateTaskDate;

var updateTaskStatus = function updateTaskStatus(_ref3) {
  var taskId = _ref3.taskId,
      status = _ref3.status;
  return (0, _request.rput)("v1")("PlanV2/UpdateStatus?plan_item_id=".concat(taskId, "&Status=").concat(status), {
    plan_item_id: taskId,
    Status: status
  }, {
    headers: {
      "Content-Type": "application/x-www-form-urlencoded"
    },
    transformRequest: _qs["default"].stringify
  });
};

exports.updateTaskStatus = updateTaskStatus;

var cancelRel = function cancelRel(_ref4) {
  var krId = _ref4.krId,
      objType = _ref4.objType,
      okrId = _ref4.okrId,
      taskId = _ref4.taskId;
  return (0, _request.rpost)("v1")("okr/task/cancelrel", {
    krId: krId,
    objType: objType,
    okrId: okrId,
    taskId: taskId
  });
}; // priority:5 非常低 4 低   3 中  2 高  1 最高


exports.cancelRel = cancelRel;

var setTaskPriority = function setTaskPriority(_ref5) {
  var taskId = _ref5.taskId,
      priority = _ref5.priority;
  return (0, _request.rpost)("v2")("task/SetTaskPriority?task_id=".concat(taskId, "&priority=").concat(priority), {});
};

exports.setTaskPriority = setTaskPriority;