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

export const whatsappConfig: ServiceConfig = {
  entity: "whatsapp",
  table: "WhatsappBot",
  displayName: "WhatsApp Connection",
  createFields: [
    {
      name: "name",
      label: "Name",
      required: true,
      size: 12,
    },
    {
      name: "description",
      label: "Description",
      size: 12,
      lines: 3,
    },
    {
      name: "phoneNumber",
      label: "Phone Number",
      required: true,
    },
    {
      name: "token",
      label: "Token",
      hidden: true,
      required: true,
      autogenerated: "token",
    },
  ],
  updateFields: [
    { name: "name", label: "Name", required: true, size: 12 },
    {
      name: "description",
      label: "Description",
      size: 12,
    },
    {
      name: "phoneNumber",
      label: "Phone Number",
      required: true,
    },
  ],
  displayFields: [
    { name: "name", label: "Name", required: true, size: 12 },
    {
      name: "description",
      label: "Description",
      size: 12,
    },
    {
      name: "phoneNumber",
      label: "Phone Number",
    },
    {
      name: "token",
      label: "Token",
      copyable: true,
    },
  ],
  listColumns: [
    {
      field: "name",
      headerName: "Name",
      flex: 1,
    },
    {
      field: "phoneNumber",
      headerName: "Phone Number",
      flex: 1,
    },
    {
      field: "description",
      headerName: "Description",
      flex: 2,
    },
    {
      field: "updatedAt",
      headerName: "Updated At",
      valueGetter: (value: any) => new Date(value).toLocaleString(),
      flex: 1,
    },
  ],
};
