"use strict";
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 media_upload_bi_exports = {};
__export(media_upload_bi_exports, {
  createUploadEndBIData: () => createUploadEndBIData,
  createUploadStartBIData: () => createUploadStartBIData
});
module.exports = __toCommonJS(media_upload_bi_exports);
var import_uuid = require("./../../wix-rich-content-common/lib/uuid.js");
const createUploadStartBIData = (pluginId, fileSize, mediaType) => {
  const correlationId = (0, import_uuid.uuid)();
  return { correlationId, pluginId, fileSize, mediaType, timeStamp: Date.now() };
};
const errorMap = {
  0: "Generic Error",
  1: "File size too big",
  2: "Quata Storage - Visitor",
  3: "Quata Storage - Owner",
  4: "Quata Video - Visitor",
  5: "Quata Video - Owner"
};
const createUploadEndBIData = (uploadBIData, error) => {
  const { correlationId, pluginId, fileSize, mediaType, timeStamp } = uploadBIData;
  const isSuccess = !error;
  const errorType = error ? error.key ? errorMap[error.key] : "Custom Error" : void 0;
  const duration = Date.now() - timeStamp;
  return {
    correlationId,
    pluginId,
    duration,
    fileSize,
    mediaType,
    isSuccess,
    errorType
  };
};
//# sourceMappingURL=media-upload-bi.js.map
