import {
  createColumnLoader,
  ColumnMetadata,
} from '../DataGrid/configBuilderFactory';

const PROJECT_MEMBERSHIPS_COLUMNS: ColumnMetadata[] = [
  {
    field: 'project',
    headerName: 'Project',
    type: 'singleSelectRelation',
    entityRef: 'projects',
    editable: true,
  },
  {
    field: 'user',
    headerName: 'User',
    type: 'singleSelectRelation',
    entityRef: 'users',
    editable: true,
  },
  {
    field: 'access_level',
    headerName: 'Accesslevel',
    type: 'text',
    editable: true,
  },
  {
    field: 'is_active',
    headerName: 'Isactive',
    type: 'boolean',
    editable: true,
  },
  {
    field: 'invited_at',
    headerName: 'Invitedat',
    type: 'datetime',
    editable: true,
  },
  {
    field: 'accepted_at',
    headerName: 'Acceptedat',
    type: 'datetime',
    editable: true,
  },
  { field: 'actions', headerName: '', type: 'actions' },
];

export const loadColumns = createColumnLoader({
  entityName: 'project_memberships',
  columns: PROJECT_MEMBERSHIPS_COLUMNS,
});
