import { generateId } from "./../../ricos-content/index.js";
import { unreachable } from "./../../_shared/uncreachable.js";
import { DEFAULT_LABEL, DEFAULT_STAR_RATING_LABEL } from "../consts.js";
const createSmartBlockTemplate = (type, t) => {
  const itemCount = getItemCountForVariant(type);
  return {
    nodes: [
      {
        type: "PARAGRAPH",
        id: generateId()
      },
      {
        type: "SMART_BLOCK",
        id: generateId(),
        smartBlockData: { type },
        nodes: Array.from({ length: itemCount }, () => createDefaultItem(type, t))
      },
      {
        type: "PARAGRAPH",
        id: generateId()
      }
    ]
  };
};
const getItemCountForVariant = (type) => {
  switch (type) {
    case "SOLID_BOXES_ALTERNATING":
    case "TIMELINE":
    case "MINIMAL_TIMELINE":
    case "CIRCLE":
      return 4;
    default:
      return 3;
  }
};
const cellDataForVariant = (type, label) => {
  switch (type) {
    case "CIRCLE_STATS":
    case "BAR_STATS":
    case "STATS":
    case "STAR_RATING":
      return { type, label };
    case "SOLID_BOXES":
    case "SOLID_BOXES_ALTERNATING":
    case "SOLID_JOINED_BOXES":
    case "TOP_LINE_TEXT":
    case "OUTLINE_BOXES_WITH_TOP_CIRCLE":
    case "PROCESS_STEPS":
    case "SIDE_LINE_TEXT":
    case "SMALL_BULLETS":
    case "NUMBERED_BOXES":
    case "BIG_BULLETS":
    case "ARROW_BULLETS":
    case "TIMELINE":
    case "MINIMAL_TIMELINE":
    case "PILLS":
    case "QUOTE_BOXES":
    case "CIRCLE":
    case "PYRAMID":
    case "STAIRCASE":
    case "VERTICAL_FUNNEL":
      return { type };
    default: {
      unreachable(type);
      return { type };
    }
  }
};
const createDefaultItem = (type, t) => {
  const label = type === "STATS" || type === "BAR_STATS" || type === "CIRCLE_STATS" ? DEFAULT_LABEL : type === "STAR_RATING" ? DEFAULT_STAR_RATING_LABEL : void 0;
  return {
    type: "SMART_BLOCK_CELL",
    id: generateId(),
    smartBlockCellData: cellDataForVariant(type, label),
    nodes: [
      {
        type: "HEADING",
        id: generateId(),
        nodes: [
          {
            type: "TEXT",
            id: "",
            textData: {
              text: t("SmartBlock_Template_Title"),
              decorations: [
                {
                  type: "BOLD",
                  fontWeightValue: 700
                }
              ]
            }
          }
        ],
        headingData: {
          level: 3
        }
      },
      {
        type: "PARAGRAPH",
        id: generateId(),
        nodes: [
          {
            type: "TEXT",
            id: "",
            textData: {
              text: t("SmartBlock_Template_Description")
            }
          }
        ]
      }
    ]
  };
};
export {
  createSmartBlockTemplate
};
//# sourceMappingURL=create-boxes-template.js.map
