import { PluginContainerData } from "./common.js";
import { HTMLData_Source } from "./plugin_html.enums.js";
function hTMLData_SourceFromJSON(object) {
  switch (object) {
    case 0:
    case "HTML":
      return HTMLData_Source.HTML;
    case 1:
    case "ADSENSE":
      return HTMLData_Source.ADSENSE;
    case 2:
    case "AI":
      return HTMLData_Source.AI;
    case 3:
    case "AI_WIDGET":
      return HTMLData_Source.AI_WIDGET;
    case -1:
    case "UNRECOGNIZED":
    default:
      return HTMLData_Source.UNRECOGNIZED;
  }
}
function hTMLData_SourceToJSON(object) {
  switch (object) {
    case HTMLData_Source.HTML:
      return "HTML";
    case HTMLData_Source.ADSENSE:
      return "ADSENSE";
    case HTMLData_Source.AI:
      return "AI";
    case HTMLData_Source.AI_WIDGET:
      return "AI_WIDGET";
    default:
      return "UNKNOWN";
  }
}
const baseHTMLData = { source: HTMLData_Source.HTML };
const HTMLData = {
  fromJSON(object) {
    const message = { ...baseHTMLData };
    message.containerData = object.containerData !== void 0 && object.containerData !== null ? PluginContainerData.fromJSON(object.containerData) : void 0;
    message.url = object.url !== void 0 && object.url !== null ? String(object.url) : void 0;
    message.html = object.html !== void 0 && object.html !== null ? String(object.html) : void 0;
    message.isAdsense = object.isAdsense !== void 0 && object.isAdsense !== null ? Boolean(object.isAdsense) : void 0;
    message.widgetId = object.widgetId !== void 0 && object.widgetId !== null ? String(object.widgetId) : void 0;
    message.source = object.source !== void 0 && object.source !== null ? hTMLData_SourceFromJSON(object.source) : HTMLData_Source.HTML;
    message.autoHeight = object.autoHeight !== void 0 && object.autoHeight !== null ? Boolean(object.autoHeight) : void 0;
    return message;
  },
  toJSON(message) {
    const obj = {};
    message.containerData !== void 0 && (obj.containerData = message.containerData ? PluginContainerData.toJSON(message.containerData) : void 0);
    message.url !== void 0 && (obj.url = message.url);
    message.html !== void 0 && (obj.html = message.html);
    message.isAdsense !== void 0 && (obj.isAdsense = message.isAdsense);
    message.widgetId !== void 0 && (obj.widgetId = message.widgetId);
    message.source !== void 0 && (obj.source = hTMLData_SourceToJSON(message.source));
    message.autoHeight !== void 0 && (obj.autoHeight = message.autoHeight);
    return obj;
  }
};
export {
  HTMLData,
  hTMLData_SourceFromJSON,
  hTMLData_SourceToJSON
};
//# sourceMappingURL=plugin_html.js.map
