import { DateField } from '@dvn/core/doldurma/src/fields/date';
import { DateDataType } from '@dvn/core/doldurma/src/fields/date/date';
import { TextField } from '@dvn/core/doldurma/src/fields/text';
import { Comparison } from '@dvn/core/models/filter';
import { TableListViewConfig } from '@dvn/core/models/table-list-view-config';
import { AppViewType } from '@dvn/core/models/view-config';
import { spaces } from '../spaces';
import { dataConfigs } from '../data-configs';
export const ID = 'table-list-view-scheduled-job-next-day-summary';
export const tableListViewUIConfigScheduledJobsNextDaySummary = TableListViewConfig.decode({
  main: {
    fields: [
      {
        fieldId: 'createdAt',
        fieldDisplay: new DateField('createdAt', 'Creation Date').setDateFormat('DD MMM YYYY HH:mm').setDataType(DateDataType.Unix),
      },
      {
        fieldId: 'scheduledAt',
        fieldDisplay: new DateField('scheduledAt', 'Scheduled Date').setDateFormat('DD MMM YYYY HH:mm'),
      },
      {
        fieldId: 'status',
      },
    ],
    columns: {
      createdAt: {
        width: 250,
      },
      scheduledAt: {
        width: 250,
      },
      'status': {
        width: 200,
      },
    },
  },
});
export const viewConfig = TableListViewConfig.decode({
  _id: ID,
  type: AppViewType.ListViewTable,
  base: 'mentornity',
  title: 'Next Day Events Summary Jobs',
  space: spaces['mentornity'],
  table: dataConfigs['scheduledjobs'],
  query: {
    fields: [
      new TextField('name', 'Name'),
      new TextField('status', 'Status'),
      new DateField('scheduledAt', 'Created At'),
      new DateField('createdAt', 'Created At'),
    ],
    filter: {
      filters: [
        {
          comparison: Comparison.Eq,
          id: 'name',
          value: 'NotificationNextDayEventsSummary',
        },
      ],
      operator: 'or'
    },
    sort: [{ id: 'createdAt', order: -1 }]
  },
  ui: tableListViewUIConfigScheduledJobsNextDaySummary,
});
