import { ServiceConfig } from "../lib/service";

export const facebookConfig: ServiceConfig = {
  entity: "facebook",
  table: "FacebookBot",
  displayName: "Facebook Connection",
  createFields: [
    {
      name: "name",
      label: "Name",
      required: true,
      size: 12,
    },
    {
      name: "description",
      label: "Description",
      size: 12,
      lines: 3,
    },
    { name: "appId", label: "App ID", required: true },
    { name: "appSecret", label: "App Secret", required: true },
    { name: "pageId", label: "Page ID", required: true },
    {
      name: "pageAccessToken",
      label: "Page Access Token",
      required: true,
    },
    {
      name: "token",
      label: "Token",
      hidden: true,
      required: true,
      autogenerated: "token",
    },
    {
      name: "verifyToken",
      label: "Verify Token",
      hidden: true,
      required: true,
      autogenerated: "token",
    },
  ],
  updateFields: [
    { name: "name", label: "Name", required: true, size: 12 },
    {
      name: "description",
      label: "Description",
      size: 12,
      lines: 3,
    },
    {
      name: "token",
      label: "Token",
      disabled: true,
      refreshable: true,
    },
    {
      name: "verifyToken",
      label: "Verify Token",
      disabled: true,
      refreshable: true,
    },
    { name: "appId", label: "App ID", required: true },
    { name: "appSecret", label: "App Secret", required: true },
    { name: "pageId", label: "Page ID", required: true },
    {
      name: "pageAccessToken",
      label: "Page Access Token",
      required: true,
    },
  ],
  displayFields: [
    { name: "name", label: "Name", required: true, size: 12 },
    {
      name: "description",
      label: "Description",
      required: true,
      size: 12,
    },
    {
      name: "token",
      label: "Token",
      copyable: true,
    },
    {
      name: "verifyToken",
      label: "Verify Token",
      copyable: true,
    },

    { name: "appId", label: "App ID", required: true },
    { name: "appSecret", label: "App Secret", required: true },
    {
      name: "pageId",
      label: "Page ID",
      required: true,
    },
    {
      name: "pageAccessToken",
      label: "Page Access Token",
      required: true,
    },
  ],
  listColumns: [
    {
      field: "name",
      headerName: "Name",
      flex: 1,
    },
    {
      field: "description",
      headerName: "Description",
      flex: 2,
    },
    {
      field: "updatedAt",
      headerName: "Updated At",
      valueGetter: (value: any) => new Date(value).toLocaleString(),
      flex: 1,
    },
  ],
};
