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

export const signalConfig: ServiceConfig = {
  entity: "signal",
  table: "SignalBot",
  displayName: "Signal Connection",
  createFields: [
    {
      name: "name",
      label: "Name",
      required: true,
      size: 12,
    },
    {
      name: "description",
      label: "Description",
      size: 12,
      lines: 3,
    },
    {
      name: "phoneNumber",
      label: "phoneNumber",
      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: "phoneNumber",
      required: true,
    },
  ],
  displayFields: [
    { name: "name", label: "Name", required: true, size: 12 },
    {
      name: "description",
      label: "Description",
      size: 12,
    },
    {
      name: "phoneNumber",
      label: "phoneNumber",
    },
    {
      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,
    },
  ],
};
