/**
 * This file is part of the NocoBase (R) project.
 * Copyright (c) 2020-2024 NocoBase Co., Ltd.
 * Authors: NocoBase Team.
 *
 * This project is dual-licensed under AGPL-3.0 and NocoBase Commercial License.
 * For more information, please refer to: https://www.nocobase.com/agreement.
 */

var __defProp = Object.defineProperty;
var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
var __getOwnPropNames = Object.getOwnPropertyNames;
var __hasOwnProp = Object.prototype.hasOwnProperty;
var __export = (target, all) => {
  for (var name in all)
    __defProp(target, name, { get: all[name], enumerable: true });
};
var __copyProps = (to, from, except, desc) => {
  if (from && typeof from === "object" || typeof from === "function") {
    for (let key of __getOwnPropNames(from))
      if (!__hasOwnProp.call(to, key) && key !== except)
        __defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
  }
  return to;
};
var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
var executionStatus_exports = {};
__export(executionStatus_exports, {
  EXECUTION_REASON_OPTIONS: () => EXECUTION_REASON_OPTIONS,
  EXECUTION_REASON_OPTIONS_MAP: () => EXECUTION_REASON_OPTIONS_MAP,
  EXECUTION_STATUS: () => EXECUTION_STATUS,
  EXECUTION_STATUS_OPTIONS: () => EXECUTION_STATUS_OPTIONS,
  EXECUTION_STATUS_OPTIONS_MAP: () => EXECUTION_STATUS_OPTIONS_MAP
});
module.exports = __toCommonJS(executionStatus_exports);
var import_constants = require("./constants");
const EXECUTION_STATUS = {
  QUEUEING: null,
  STARTED: 0,
  RESOLVED: 1,
  FAILED: -1,
  ERROR: -2,
  ABORTED: -3,
  CANCELED: -4,
  REJECTED: -5,
  RETRY_NEEDED: -6
};
const EXECUTION_STATUS_OPTIONS = [
  {
    value: EXECUTION_STATUS.QUEUEING,
    label: `{{t("Queueing", { ns: "${import_constants.NAMESPACE}" })}}`,
    color: "blue",
    description: `{{t("Triggered but still waiting in queue to execute.", { ns: "${import_constants.NAMESPACE}" })}}`
  },
  {
    value: EXECUTION_STATUS.STARTED,
    label: `{{t("On going", { ns: "${import_constants.NAMESPACE}" })}}`,
    color: "gold",
    description: `{{t("Started and executing, maybe waiting for an async callback (manual, delay etc.).", { ns: "${import_constants.NAMESPACE}" })}}`
  },
  {
    value: EXECUTION_STATUS.RESOLVED,
    label: `{{t("Resolved", { ns: "${import_constants.NAMESPACE}" })}}`,
    color: "green",
    description: `{{t("Successfully finished.", { ns: "${import_constants.NAMESPACE}" })}}`
  },
  {
    value: EXECUTION_STATUS.FAILED,
    label: `{{t("Failed", { ns: "${import_constants.NAMESPACE}" })}}`,
    color: "red",
    description: `{{t("Failed to satisfy node configurations.", { ns: "${import_constants.NAMESPACE}" })}}`
  },
  {
    value: EXECUTION_STATUS.ERROR,
    label: `{{t("Error", { ns: "${import_constants.NAMESPACE}" })}}`,
    color: "red",
    description: `{{t("Some node meets error.", { ns: "${import_constants.NAMESPACE}" })}}`
  },
  {
    value: EXECUTION_STATUS.ABORTED,
    label: `{{t("Aborted", { ns: "${import_constants.NAMESPACE}" })}}`,
    color: "red",
    description: `{{t("Running of some node was aborted by program flow.", { ns: "${import_constants.NAMESPACE}" })}}`
  },
  {
    value: EXECUTION_STATUS.CANCELED,
    label: `{{t("Canceled", { ns: "${import_constants.NAMESPACE}" })}}`,
    color: "volcano",
    description: `{{t("Manually canceled whole execution when waiting.", { ns: "${import_constants.NAMESPACE}" })}}`
  },
  {
    value: EXECUTION_STATUS.REJECTED,
    label: `{{t("Rejected", { ns: "${import_constants.NAMESPACE}" })}}`,
    color: "volcano",
    description: `{{t("Rejected from a manual node.", { ns: "${import_constants.NAMESPACE}" })}}`
  },
  {
    value: EXECUTION_STATUS.RETRY_NEEDED,
    label: `{{t("Retry needed", { ns: "${import_constants.NAMESPACE}" })}}`,
    color: "volcano",
    description: `{{t("General failed but should do another try.", { ns: "${import_constants.NAMESPACE}" })}}`
  }
];
const EXECUTION_STATUS_OPTIONS_MAP = EXECUTION_STATUS_OPTIONS.reduce(
  (map, option) => Object.assign(map, { [option.value]: option }),
  {}
);
const EXECUTION_REASON_OPTIONS = [
  {
    value: import_constants.EXECUTION_REASON.TIMEOUT,
    label: `{{t("Timed out", { ns: "${import_constants.NAMESPACE}" })}}`
  },
  {
    value: import_constants.EXECUTION_REASON.MANUAL_CANCEL,
    label: `{{t("Canceled manually", { ns: "${import_constants.NAMESPACE}" })}}`
  },
  {
    value: import_constants.EXECUTION_REASON.PARENT_ABORTED,
    label: `{{t("Aborted with parent execution", { ns: "${import_constants.NAMESPACE}" })}}`
  }
];
const EXECUTION_REASON_OPTIONS_MAP = EXECUTION_REASON_OPTIONS.reduce(
  (map, option) => Object.assign(map, { [option.value]: option }),
  {}
);
// Annotate the CommonJS export names for ESM import in node:
0 && (module.exports = {
  EXECUTION_REASON_OPTIONS,
  EXECUTION_REASON_OPTIONS_MAP,
  EXECUTION_STATUS,
  EXECUTION_STATUS_OPTIONS,
  EXECUTION_STATUS_OPTIONS_MAP
});
