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

export const usersConfig: ServiceConfig = {
  entity: "users",
  table: "User",
  displayName: "User",
  createFields: [
    {
      name: "name",
      label: "Name",
      required: true,
      size: 12,
    },
    {
      name: "email",
      label: "Email",
      required: true,
      size: 12,
    },
  ],
  updateFields: [
    { name: "name", label: "Name", required: true, size: 12 },
    {
      name: "email",
      label: "Email",
      required: true,
      size: 12,
    },
  ],
  displayFields: [
    { name: "name", label: "Name", required: true, size: 12 },
    {
      name: "email",
      label: "Email",
      size: 12,
    },
  ],
  listColumns: [
    {
      field: "name",
      headerName: "Name",
      flex: 1,
    },
    {
      field: "email",
      headerName: "Email",
      flex: 2,
    },
    {
      field: "updatedAt",
      headerName: "Updated At",
      valueGetter: (value: any) => new Date(value).toLocaleString(),
      flex: 1,
    },
  ],
};
