"use strict";
Object.defineProperty(exports, "__esModule", {
  value: !0
}), exports.default = _default, exports.USER_COMPANY_SUPERIOR_LIST_ERROR = exports.USER_COMPANY_SUPERIOR_LIST_SUCCESS = exports.USER_COMPANY_SUPERIOR_LIST = exports.USER_DEPARTMENT_TREE_BY_COMPANY_ERROR = exports.USER_DEPARTMENT_TREE_BY_COMPANY_SUCCESS = exports.USER_DEPARTMENT_TREE_BY_COMPANY = exports.USER_EDIT_PASSWORD_ERROR = exports.USER_EDIT_PASSWORD_SUCCESS = exports.USER_EDIT_PASSWORD = exports.USER_ENABLE_ERROR = exports.USER_ENABLE_SUCCESS = exports.USER_ENABLE = exports.USER_DISABLE_ERROR = exports.USER_DISABLE_SUCCESS = exports.USER_DISABLE = exports.USER_INFO_ERROR = exports.USER_INFO_SUCCESS = exports.USER_INFO = exports.USER_EDIT_ERROR = exports.USER_EDIT_SUCCESS = exports.USER_EDIT = exports.USER_ADD_ERROR = exports.USER_ADD_SUCCESS = exports.USER_ADD = exports.USER_DEL_ERROR = exports.USER_DEL_SUCCESS = exports.USER_DEL = exports.USER_TABLE_INFOS_ERROR = exports.USER_TABLE_INFOS_SUCCESS = exports.USER_TABLE_INFOS = exports.USER_REGION_TREE_ERROR = exports.USER_REGION_TREE_SUCCESS = exports.USER_REGION_TREE = exports.USER_ALL_ROLE_ERROR = exports.USER_ALL_ROLE_SUCCESS = exports.USER_ALL_ROLE = void 0;
var _actionCreator = _interopRequireDefault(require("amos-processor/lib/redux/actionCreator")),
  _urlFormat = _interopRequireDefault(require("amos-processor/lib/utils/urlFormat"));

function _interopRequireDefault(E) {
  return E && E.__esModule ? E : {
    default: E
  }
}
var USER_ALL_ROLE = "USER_ALL_ROLE";
exports.USER_ALL_ROLE = USER_ALL_ROLE;
var USER_ALL_ROLE_SUCCESS = "USER_ALL_ROLE_SUCCESS";
exports.USER_ALL_ROLE_SUCCESS = USER_ALL_ROLE_SUCCESS;
var USER_ALL_ROLE_ERROR = "USER_ALL_ROLE_ERROR";
exports.USER_ALL_ROLE_ERROR = USER_ALL_ROLE_ERROR;
var USER_REGION_TREE = "USER_REGION_TREE";
exports.USER_REGION_TREE = USER_REGION_TREE;
var USER_REGION_TREE_SUCCESS = "USER_REGION_TREE_SUCCESS";
exports.USER_REGION_TREE_SUCCESS = USER_REGION_TREE_SUCCESS;
var USER_REGION_TREE_ERROR = "USER_REGION_TREE_ERROR";
exports.USER_REGION_TREE_ERROR = USER_REGION_TREE_ERROR;
var USER_TABLE_INFOS = "USER_TABLE_INFOS";
exports.USER_TABLE_INFOS = USER_TABLE_INFOS;
var USER_TABLE_INFOS_SUCCESS = "USER_TABLE_INFOS_SUCCESS";
exports.USER_TABLE_INFOS_SUCCESS = USER_TABLE_INFOS_SUCCESS;
var USER_TABLE_INFOS_ERROR = "USER_TABLE_INFOS_ERROR";
exports.USER_TABLE_INFOS_ERROR = USER_TABLE_INFOS_ERROR;
var USER_DEL = "USER_DEL";
exports.USER_DEL = USER_DEL;
var USER_DEL_SUCCESS = "USER_DEL_SUCCESS";
exports.USER_DEL_SUCCESS = USER_DEL_SUCCESS;
var USER_DEL_ERROR = "USER_DEL_ERROR";
exports.USER_DEL_ERROR = USER_DEL_ERROR;
var USER_ADD = "USER_ADD";
exports.USER_ADD = USER_ADD;
var USER_ADD_SUCCESS = "USER_ADD_SUCCESS";
exports.USER_ADD_SUCCESS = USER_ADD_SUCCESS;
var USER_ADD_ERROR = "USER_ADD_ERROR";
exports.USER_ADD_ERROR = USER_ADD_ERROR;
var USER_EDIT = "USER_EDIT";
exports.USER_EDIT = USER_EDIT;
var USER_EDIT_SUCCESS = "USER_EDIT_SUCCESS";
exports.USER_EDIT_SUCCESS = USER_EDIT_SUCCESS;
var USER_EDIT_ERROR = "USER_EDIT_ERROR";
exports.USER_EDIT_ERROR = USER_EDIT_ERROR;
var USER_INFO = "USER_INFO";
exports.USER_INFO = USER_INFO;
var USER_INFO_SUCCESS = "USER_INFO_SUCCESS";
exports.USER_INFO_SUCCESS = USER_INFO_SUCCESS;
var USER_INFO_ERROR = "USER_INFO_ERROR";
exports.USER_INFO_ERROR = USER_INFO_ERROR;
var USER_DISABLE = "USER_DISABLE";
exports.USER_DISABLE = USER_DISABLE;
var USER_DISABLE_SUCCESS = "USER_DISABLE_SUCCESS";
exports.USER_DISABLE_SUCCESS = USER_DISABLE_SUCCESS;
var USER_DISABLE_ERROR = "USER_DISABLE_ERROR";
exports.USER_DISABLE_ERROR = USER_DISABLE_ERROR;
var USER_ENABLE = "USER_ENABLE";
exports.USER_ENABLE = USER_ENABLE;
var USER_ENABLE_SUCCESS = "USER_ENABLE_SUCCESS";
exports.USER_ENABLE_SUCCESS = USER_ENABLE_SUCCESS;
var USER_ENABLE_ERROR = "USER_ENABLE_ERROR";
exports.USER_ENABLE_ERROR = USER_ENABLE_ERROR;
var USER_EDIT_PASSWORD = "USER_EDIT_PASSWORD";
exports.USER_EDIT_PASSWORD = USER_EDIT_PASSWORD;
var USER_EDIT_PASSWORD_SUCCESS = "USER_EDIT_PASSWORD_SUCCESS";
exports.USER_EDIT_PASSWORD_SUCCESS = USER_EDIT_PASSWORD_SUCCESS;
var USER_EDIT_PASSWORD_ERROR = "USER_EDIT_PASSWORD_ERROR";
exports.USER_EDIT_PASSWORD_ERROR = USER_EDIT_PASSWORD_ERROR;
var USER_DEPARTMENT_TREE_BY_COMPANY = "USER_DEPARTMENT_TREE_BY_COMPANY";
exports.USER_DEPARTMENT_TREE_BY_COMPANY = USER_DEPARTMENT_TREE_BY_COMPANY;
var USER_DEPARTMENT_TREE_BY_COMPANY_SUCCESS = "USER_DEPARTMENT_TREE_BY_COMPANY_SUCCESS";
exports.USER_DEPARTMENT_TREE_BY_COMPANY_SUCCESS = USER_DEPARTMENT_TREE_BY_COMPANY_SUCCESS;
var USER_DEPARTMENT_TREE_BY_COMPANY_ERROR = "USER_DEPARTMENT_TREE_BY_COMPANY_ERROR";
exports.USER_DEPARTMENT_TREE_BY_COMPANY_ERROR = USER_DEPARTMENT_TREE_BY_COMPANY_ERROR;
var USER_COMPANY_SUPERIOR_LIST = "USER_COMPANY_SUPERIOR_LIST";
exports.USER_COMPANY_SUPERIOR_LIST = USER_COMPANY_SUPERIOR_LIST;
var USER_COMPANY_SUPERIOR_LIST_SUCCESS = "USER_COMPANY_SUPERIOR_LIST_SUCCESS";
exports.USER_COMPANY_SUPERIOR_LIST_SUCCESS = USER_COMPANY_SUPERIOR_LIST_SUCCESS;
var USER_COMPANY_SUPERIOR_LIST_ERROR = "USER_COMPANY_SUPERIOR_LIST_ERROR";
exports.USER_COMPANY_SUPERIOR_LIST_ERROR = USER_COMPANY_SUPERIOR_LIST_ERROR;
var defaultPageable = {
    current: 0,
    pageSize: 10
  },
  buildPageable = function(E, R) {
    var _ = 1 < arguments.length && void 0 !== R ? R : defaultPageable,
      R = _.current,
      _ = _.pageSize;
    return "".concat(E, "?current=").concat(R, "&pageSize=").concat(_)
  };

function _default(E) {
  var S = completeSecurityUrl(E);
  return {
    userTableAction: function(E, R, _) {
      return (0, _actionCreator.default)({
        type: USER_TABLE_INFOS,
        method: "get",
        url: "".concat(buildPageable(S.userInfos, E), "&filter=").concat(R).concat(_)
      })
    },
    userDelAction: function(E) {
      return (0, _actionCreator.default)({
        type: USER_DEL,
        method: "del",
        url: "".concat(S.delUser, "?ids=").concat(E)
      })
    },
    userAddAction: function(E) {
      return (0, _actionCreator.default)({
        type: USER_ADD,
        method: "put",
        url: S.addUser,
        data: E
      })
    },
    userEditAction: function(E) {
      return (0, _actionCreator.default)({
        type: USER_EDIT,
        method: "put",
        url: S.editUser,
        data: E
      })
    },
    userEditPasswordAction: function(E) {
      return (0, _actionCreator.default)({
        type: USER_EDIT_PASSWORD,
        method: "put",
        url: S.editPassword,
        data: E
      })
    },
    userDisableAction: function(E) {
      return (0, _actionCreator.default)({
        type: USER_DISABLE,
        method: "put",
        url: "".concat(S.userDisable, "/").concat(E)
      })
    },
    userEnableAction: function(E) {
      return (0, _actionCreator.default)({
        type: USER_ENABLE,
        method: "put",
        url: "".concat(S.userEnable, "/").concat(E)
      })
    },
    getUserByIdAction: function(E) {
      return (0, _actionCreator.default)({
        type: USER_INFO,
        method: "get",
        url: "".concat(S.getUserById, "?userId=").concat(E)
      })
    },
    getAllRoleAction: function() {
      return (0, _actionCreator.default)({
        type: USER_ALL_ROLE,
        method: "get",
        url: S.getAllRole
      })
    },
    superiorUnitAction: function() {
      return (0, _actionCreator.default)({
        type: USER_COMPANY_SUPERIOR_LIST,
        method: "get",
        url: S.superiorUnitUrl
      })
    },
    getDepartmentByCompanyAction: function(E) {
      return (0, _actionCreator.default)({
        type: USER_DEPARTMENT_TREE_BY_COMPANY,
        method: "get",
        url: (0, _urlFormat.default)(S.getDepartmentByCompany, {
          id: E
        })
      })
    }
  }
}
