import { PluginContainerData, FileSource } from "./common.js";
import { FileData_PDFSettings_ViewMode } from "./plugin_file.enums.js";
function fileData_PDFSettings_ViewModeFromJSON(object) {
  switch (object) {
    case 0:
    case "NONE":
      return FileData_PDFSettings_ViewMode.NONE;
    case 1:
    case "FULL":
      return FileData_PDFSettings_ViewMode.FULL;
    case 2:
    case "MINI":
      return FileData_PDFSettings_ViewMode.MINI;
    case -1:
    case "UNRECOGNIZED":
    default:
      return FileData_PDFSettings_ViewMode.UNRECOGNIZED;
  }
}
function fileData_PDFSettings_ViewModeToJSON(object) {
  switch (object) {
    case FileData_PDFSettings_ViewMode.NONE:
      return "NONE";
    case FileData_PDFSettings_ViewMode.FULL:
      return "FULL";
    case FileData_PDFSettings_ViewMode.MINI:
      return "MINI";
    default:
      return "UNKNOWN";
  }
}
const baseFileData = {};
const FileData = {
  fromJSON(object) {
    const message = { ...baseFileData };
    message.containerData = object.containerData !== void 0 && object.containerData !== null ? PluginContainerData.fromJSON(object.containerData) : void 0;
    message.src = object.src !== void 0 && object.src !== null ? FileSource.fromJSON(object.src) : void 0;
    message.name = object.name !== void 0 && object.name !== null ? String(object.name) : void 0;
    message.type = object.type !== void 0 && object.type !== null ? String(object.type) : void 0;
    message.size = object.size !== void 0 && object.size !== null ? Number(object.size) : void 0;
    message.pdfSettings = object.pdfSettings !== void 0 && object.pdfSettings !== null ? FileData_PDFSettings.fromJSON(object.pdfSettings) : void 0;
    message.mimeType = object.mimeType !== void 0 && object.mimeType !== null ? String(object.mimeType) : void 0;
    message.path = object.path !== void 0 && object.path !== null ? String(object.path) : void 0;
    message.sizeInKb = object.sizeInKb !== void 0 && object.sizeInKb !== null ? String(object.sizeInKb) : void 0;
    return message;
  },
  toJSON(message) {
    const obj = {};
    message.containerData !== void 0 && (obj.containerData = message.containerData ? PluginContainerData.toJSON(message.containerData) : void 0);
    message.src !== void 0 && (obj.src = message.src ? FileSource.toJSON(message.src) : void 0);
    message.name !== void 0 && (obj.name = message.name);
    message.type !== void 0 && (obj.type = message.type);
    message.size !== void 0 && (obj.size = message.size);
    message.pdfSettings !== void 0 && (obj.pdfSettings = message.pdfSettings ? FileData_PDFSettings.toJSON(message.pdfSettings) : void 0);
    message.mimeType !== void 0 && (obj.mimeType = message.mimeType);
    message.path !== void 0 && (obj.path = message.path);
    message.sizeInKb !== void 0 && (obj.sizeInKb = message.sizeInKb);
    return obj;
  }
};
const baseFileData_PDFSettings = {
  viewMode: FileData_PDFSettings_ViewMode.NONE
};
const FileData_PDFSettings = {
  fromJSON(object) {
    const message = { ...baseFileData_PDFSettings };
    message.viewMode = object.viewMode !== void 0 && object.viewMode !== null ? fileData_PDFSettings_ViewModeFromJSON(object.viewMode) : FileData_PDFSettings_ViewMode.NONE;
    message.disableDownload = object.disableDownload !== void 0 && object.disableDownload !== null ? Boolean(object.disableDownload) : void 0;
    message.disablePrint = object.disablePrint !== void 0 && object.disablePrint !== null ? Boolean(object.disablePrint) : void 0;
    return message;
  },
  toJSON(message) {
    const obj = {};
    message.viewMode !== void 0 && (obj.viewMode = fileData_PDFSettings_ViewModeToJSON(message.viewMode));
    message.disableDownload !== void 0 && (obj.disableDownload = message.disableDownload);
    message.disablePrint !== void 0 && (obj.disablePrint = message.disablePrint);
    return obj;
  }
};
export {
  FileData,
  FileData_PDFSettings,
  fileData_PDFSettings_ViewModeFromJSON,
  fileData_PDFSettings_ViewModeToJSON
};
//# sourceMappingURL=plugin_file.js.map
