import { getElementId, randomCode } from "../../plugins/utils";

const MODEL = {
  type: "TOPIC_HEAD",
  x: 0,
  y: 0,
  w: 0,
  h: 60,
  content: "",
  typeName: "",
  isColumnFirst: false,
  sign: "objective", // objective:客观题,subjective:主观题
};

const getModel = (content, type, isColumnFirst) => {
  const typeName = type === "objective" ? "客观题" : "主观题";
  const element = { ...MODEL };
  element.sign = type;
  element.typeName = typeName;
  element.content = content;
  element.isColumnFirst = isColumnFirst;
  element.h = isColumnFirst ? element.h : element.h + 10;
  element.id = getElementId();
  element.key = randomCode();
  return element;
};

export { MODEL, getModel };
