import { ANALYTICS_MEDIA_CHANNEL, sanitiseAnalyticsPayload } from '@atlaskit/media-common/analytics';
var componentName = 'mediaViewer';
var packageName = "@atlaskit/media-viewer";
var packageVersion = "0.0.0-development";
export { packageName, packageVersion, componentName, componentName as component };
export function getFileAttributes(fileState) {
  if (!fileState) {
    return {
      fileId: 'undefined'
    };
  }
  var fileId = fileState.id;
  switch (fileState.status) {
    case 'uploading':
    case 'failed-processing':
    case 'processing':
    case 'processed':
      var fileMediatype = fileState.mediaType,
        fileMimetype = fileState.mimeType,
        fileSize = fileState.size;
      return {
        fileId: fileId,
        fileMediatype: fileMediatype,
        fileMimetype: fileMimetype,
        fileSize: fileSize
      };
    case 'error':
      return {
        fileId: fileId
      };
  }
}

/** This type takes FailureAttributes and redefines `failReason` to be the strong media-viewer type */

export function fireAnalytics(payload, createAnalyticsEvent) {
  if (createAnalyticsEvent) {
    var ev = createAnalyticsEvent(sanitiseAnalyticsPayload(payload));
    ev.fire(ANALYTICS_MEDIA_CHANNEL);
  }
}