/**
 * Access Logs List Page
 */

import { createListPage } from '../../factories/createListPage';
import TableAccess_logs from '../../components/Access_logs/TableAccess_logs';
import {
  uploadCsv,
  setRefetch,
} from '../../stores/access_logs/access_logsSlice';
import { Filter } from '../../types/filters';

const filters: Filter[] = [
  { label: 'Path', title: 'path' },
  { label: 'IPaddress', title: 'ip_address' },
  { label: 'Useragent', title: 'user_agent' },
  { label: 'Accessedat', title: 'accessed_at', date: true },
  { label: 'Project', title: 'project' },
  { label: 'User', title: 'user' },
  {
    label: 'Environment',
    title: 'environment',
    type: 'enum',
    options: ['admin', 'stage', 'production'],
  },
];

export default createListPage({
  entityName: 'access_logs',
  entityTitle: 'Access_logs',
  TableComponent: TableAccess_logs,
  filters,
  readPermission: 'READ_ACCESS_LOGS',
  createPermission: 'CREATE_ACCESS_LOGS',
  uploadCsvAction: uploadCsv,
  setRefetchAction: setRefetch,
});
