import { DataTransferField } from '@dvn/core/doldurma/src/fields/query-include/data-transfer-field';
import { TableListViewConfig } from '@dvn/core/models/table-list-view-config';
import { AppViewType } from '@dvn/core/models/view-config';
import { dataConfigs } from '../data-configs';
import { spaces } from '../spaces';
import { organisationTableListViewUIConfig } from './table-list-view-organisation';
export const ID = 'table-list-view-organisation-newest';
export const viewConfig = TableListViewConfig.decode({
  _id: ID,
  type: AppViewType.ListViewTable,
  base: 'mentornity',
  title: 'Newest Organisations',
  space: spaces['mentornity'],
  table: dataConfigs['organisations'],
  query: {
    fields: [
      new DataTransferField('status'),
      new DataTransferField('model'),
      new DataTransferField('logoUrl'),
      new DataTransferField('domain'),
      new DataTransferField('title'),
      new DataTransferField('description'),
      new DataTransferField('createdAt'),
      {
        type: 'reverse-reference',
        id: 'summary',
        otherCollection: 'organisationSummaries',
        nameInOtherCollection: 'organisation',
        isSingle: true,
        fields: [{ id: 'metrics' }]
      }
    ],
    sort: [{ id: 'createdAt', order: -1 }]
  },
  ui: organisationTableListViewUIConfig,
});
