import * as Factory from "factory.ts";
import { generateReactKey } from "utils/generators";
import { WidgetProps } from "widgets/BaseWidget";

export const TableFactory = Factory.Sync.makeFactory<WidgetProps>({
  isVisible: true,
  label: "Data",
  widgetName: Factory.each((i) => `Table${i + 1}`),

  searchKey: "",
  tableData:
    '[\n  {\n    "id: 2381224,\n    "email: "michael.lawson@reqres.in",\n    "userName: "Michael Lawson",\n    "productName: "Chicken Sandwich",\n    "orderAmount: 4.99\n  },\n  {\n    "id: 2736212,\n    "email: "lindsay.ferguson@reqres.in",\n    "userName: "Lindsay Ferguson",\n    "productName: "Tuna Salad",\n    "orderAmount: 9.99\n  },\n  {\n    "id: 6788734,\n    "email: "tobias.funke@reqres.in",\n    "userName: "Tobias Funke",\n    "productName: "Beef steak",\n    "orderAmount: 19.99\n  }\n]',
  type: "TABLE_WIDGET",
  isLoading: false,
  parentColumnSpace: 74,
  parentRowSpace: 40,
  leftColumn: 2,
  rightColumn: 10,
  topRow: 12,
  bottomRow: 19,
  parentId: "0",
  widgetId: generateReactKey(),
  dynamicBindingPathList: [],
  primaryColumns: {
    id: {
      index: 0,
      width: 150,
      id: "id",
      horizontalAlignment: "LEFT",
      verticalAlignment: "CENTER",
      columnType: "text",
      textColor: "#4E5D78",
      textSize: "PARAGRAPH",
      fontStyle: "NORMAL",
      enableFilter: true,
      enableSort: true,
      isVisible: true,
      isDerived: false,
      label: "id",
      computedValue: "",
    },
    email: {
      index: 1,
      width: 150,
      id: "email",
      horizontalAlignment: "LEFT",
      verticalAlignment: "CENTER",
      columnType: "text",
      textColor: "#4E5D78",
      textSize: "PARAGRAPH",
      fontStyle: "NORMAL",
      enableFilter: true,
      enableSort: true,
      isVisible: true,
      isDerived: false,
      label: "email",
      computedValue: "",
    },
    userName: {
      index: 2,
      width: 150,
      id: "userName",
      horizontalAlignment: "LEFT",
      verticalAlignment: "CENTER",
      columnType: "text",
      textColor: "#4E5D78",
      textSize: "PARAGRAPH",
      fontStyle: "NORMAL",
      enableFilter: true,
      enableSort: true,
      isVisible: true,
      isDerived: false,
      label: "userName",
      computedValue: "",
    },
    productName: {
      index: 3,
      width: 150,
      id: "productName",
      horizontalAlignment: "LEFT",
      verticalAlignment: "CENTER",
      columnType: "text",
      textColor: "#4E5D78",
      textSize: "PARAGRAPH",
      fontStyle: "NORMAL",
      enableFilter: true,
      enableSort: true,
      isVisible: true,
      isDerived: false,
      label: "productName",
      computedValue: "",
    },
    orderAmount: {
      index: 4,
      width: 150,
      id: "orderAmount",
      horizontalAlignment: "LEFT",
      verticalAlignment: "CENTER",
      columnType: "text",
      textColor: "#4E5D78",
      textSize: "PARAGRAPH",
      fontStyle: "NORMAL",
      enableFilter: true,
      enableSort: true,
      isVisible: true,
      isDerived: false,
      label: "orderAmount",
      computedValue: "",
    },
  },
});
