import FormWidgetIcon  from "@/assets/widgetCover/form.svg";
import i18n from "@/i18n/config";
import { BasicContainerConfig } from "@/widgetLibrary/BasicContainer/BasicContainer";
import { WidgetConfig } from "@/widgetLibrary/interface";
export const FORM_WIDGET_CONFIG: WidgetConfig = {
  type: "FORM_WIDGET",
  displayName: "form",
  widgetName: i18n.t("widget.form.name"),
  keywords: ["form", "表单"],
  icon: <FormWidgetIcon />,
  sessionType: "CONTAINER",
  // w: 10,
  // h: 19,
  version: 0,
  childrenNode: [
    BasicContainerConfig,
    BasicContainerConfig,
    BasicContainerConfig,
    BasicContainerConfig,
  ],
  defaults: {
    Mobile: {
      columnSize: "1",
      columnFraction: ["1fr"],
      gridGap: 1,
    },
    Tablet: {
      columnSize: "3",
      columnFraction: ["1fr", "1fr", "1fr"],
      gridGap: 4,
    },
    Desktop: {
      columnSize: "4",
      columnFraction: ["1fr", "1fr", "1fr", "1fr"],
      gridGap: 10,
    },
    dynamicHeight: "auto",
    validateInputsOnSubmit: true,
    resetAfterSuccessful: true,
    radius: "4px",
    shadow: "small",
  },
};

export const FORM_BODY_MIN_HEIGHT = 100;
export const FORM_MIN_FOOTER_HEIGHT_ROW_NUMBER = 7;
export const FORM_MIN_HEADER_HEIGHT_ROW_NUMBER = 7;
export const FORM_BODY_MARGIN = 7;

export const FORM_CAN_BIND_WIDGET_TYPE = new Map([
  ["INPUT_WIDGET", true],
  ["TEXTAREA_INPUT_WIDGET", true],
  ["NUMBER_INPUT_WIDGET", true],
  ["SELECT_WIDGET", true],
  ["MULTISELECT_WIDGET", true],
  ["RADIO_BUTTON_WIDGET", true],
  ["RADIO_WIDGET", true],
  ["CHECKBOX_GROUP_WIDGET", true],
  ["DATE_RANGE_WIDGET", true],
  ["DATE_TIME_WIDGET", true],
  ["DATE_WIDGET", true],
  ["RATE_WIDGET", true],
  ["FORM_WIDGET", true],
  ["FILE_INPUT_WIDGET", true],
  ["UPLOAD_WIDGET", true],
  ["TIME_PICKER_WIDGET", true],
  ["TIME_RANGE_WIDGET", true],
  ["GridCONTAINER_WIDGET", true],
  ["SWITCH_GROUP_WIDGET", true],
  ["RECORDING_WIDGET", true],
  ["EDITABLE_TEXT_WIDGET", true],
  ["SIGNATURE_WIDGET", true],
]);
