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

const MODEL = {
  type: "PAPER_PROPS",
  x: 0,
  y: 0,
  w: 200,
  h: 32,
  props: [
    {
      name: "试卷类型",
      field: "paperType",
      options: ["A", "B"],
      value: "",
      enable: true,
    },
    {
      name: "考试形式",
      field: "examType",
      options: ["开", "闭"],
      value: "",
      enable: true,
    },
    {
      name: "考试时间",
      field: "examTime",
      options: null,
      value: "",
      enable: true,
      unit: "分钟",
    },
  ],
};

const getModel = (presetData) => {
  const model = objAssign(deepCopy(MODEL), presetData);
  model.id = getElementId();
  model.key = randomCode();
  return model;
};

export { MODEL, getModel };
