/**
 * Project Memberships List Page
 */

import { createListPage } from '../../factories/createListPage';
import TableProject_memberships from '../../components/Project_memberships/TableProject_memberships';
import {
  uploadCsv,
  setRefetch,
} from '../../stores/project_memberships/project_membershipsSlice';
import { Filter } from '../../types/filters';

const filters: Filter[] = [
  { label: 'Invitedat', title: 'invited_at', date: true },
  { label: 'Acceptedat', title: 'accepted_at', date: true },
  { label: 'Project', title: 'project' },
  { label: 'User', title: 'user' },
  {
    label: 'Accesslevel',
    title: 'access_level',
    type: 'enum',
    options: ['owner', 'editor', 'reviewer', 'viewer'],
  },
];

export default createListPage({
  entityName: 'project_memberships',
  entityTitle: 'Project_memberships',
  TableComponent: TableProject_memberships,
  filters,
  readPermission: 'READ_PROJECT_MEMBERSHIPS',
  createPermission: 'CREATE_PROJECT_MEMBERSHIPS',
  uploadCsvAction: uploadCsv,
  setRefetchAction: setRefetch,
});
