import { TocData_ListStyle, TocData_Indentation } from "./plugin_toc.enums.js";
function tocData_ListStyleFromJSON(object) {
  switch (object) {
    case 0:
    case "PLAIN":
      return TocData_ListStyle.PLAIN;
    case 1:
    case "NUMBERED":
      return TocData_ListStyle.NUMBERED;
    case 2:
    case "LETTERS":
      return TocData_ListStyle.LETTERS;
    case 3:
    case "ROMAN":
      return TocData_ListStyle.ROMAN;
    case 4:
    case "BULLETED":
      return TocData_ListStyle.BULLETED;
    case 5:
    case "ALPHABETICAL_INDEX":
      return TocData_ListStyle.ALPHABETICAL_INDEX;
    case 6:
    case "ALPHABETICAL_INDEX_COMPACT":
      return TocData_ListStyle.ALPHABETICAL_INDEX_COMPACT;
    case -1:
    case "UNRECOGNIZED":
    default:
      return TocData_ListStyle.UNRECOGNIZED;
  }
}
function tocData_ListStyleToJSON(object) {
  switch (object) {
    case TocData_ListStyle.PLAIN:
      return "PLAIN";
    case TocData_ListStyle.NUMBERED:
      return "NUMBERED";
    case TocData_ListStyle.LETTERS:
      return "LETTERS";
    case TocData_ListStyle.ROMAN:
      return "ROMAN";
    case TocData_ListStyle.BULLETED:
      return "BULLETED";
    case TocData_ListStyle.ALPHABETICAL_INDEX:
      return "ALPHABETICAL_INDEX";
    case TocData_ListStyle.ALPHABETICAL_INDEX_COMPACT:
      return "ALPHABETICAL_INDEX_COMPACT";
    default:
      return "UNKNOWN";
  }
}
function tocData_IndentationFromJSON(object) {
  switch (object) {
    case 0:
    case "NESTED":
      return TocData_Indentation.NESTED;
    case 1:
    case "FLAT":
      return TocData_Indentation.FLAT;
    case -1:
    case "UNRECOGNIZED":
    default:
      return TocData_Indentation.UNRECOGNIZED;
  }
}
function tocData_IndentationToJSON(object) {
  switch (object) {
    case TocData_Indentation.NESTED:
      return "NESTED";
    case TocData_Indentation.FLAT:
      return "FLAT";
    default:
      return "UNKNOWN";
  }
}
const baseTocData = {
  includedHeadings: 0,
  listStyle: TocData_ListStyle.PLAIN,
  indentation: TocData_Indentation.NESTED
};
const TocData = {
  fromJSON(object) {
    const message = { ...baseTocData };
    message.includedHeadings = (object.includedHeadings ?? []).map(
      (e) => Number(e)
    );
    message.listStyle = object.listStyle !== void 0 && object.listStyle !== null ? tocData_ListStyleFromJSON(object.listStyle) : TocData_ListStyle.PLAIN;
    message.fontSize = object.fontSize !== void 0 && object.fontSize !== null ? Number(object.fontSize) : void 0;
    message.itemSpacing = object.itemSpacing !== void 0 && object.itemSpacing !== null ? Number(object.itemSpacing) : void 0;
    message.color = object.color !== void 0 && object.color !== null ? String(object.color) : void 0;
    message.indentation = object.indentation !== void 0 && object.indentation !== null ? tocData_IndentationFromJSON(object.indentation) : TocData_Indentation.NESTED;
    return message;
  },
  toJSON(message) {
    const obj = {};
    if (message.includedHeadings) {
      obj.includedHeadings = message.includedHeadings.map((e) => Math.round(e));
    } else {
      obj.includedHeadings = [];
    }
    message.listStyle !== void 0 && (obj.listStyle = tocData_ListStyleToJSON(message.listStyle));
    message.fontSize !== void 0 && (obj.fontSize = message.fontSize);
    message.itemSpacing !== void 0 && (obj.itemSpacing = message.itemSpacing);
    message.color !== void 0 && (obj.color = message.color);
    message.indentation !== void 0 && (obj.indentation = tocData_IndentationToJSON(message.indentation));
    return obj;
  }
};
export {
  TocData,
  tocData_IndentationFromJSON,
  tocData_IndentationToJSON,
  tocData_ListStyleFromJSON,
  tocData_ListStyleToJSON
};
//# sourceMappingURL=plugin_toc.js.map
