import { DateField } from '@dvn/core/doldurma/src/fields/date';
import { DateDataType } from '@dvn/core/doldurma/src/fields/date/date';
import { RawDataField } from '@dvn/core/doldurma/src/fields/raw-data';
import { DetailViewConfig } from '@dvn/core/models/detail-view-config';
import { Comparison } from '@dvn/core/models/filter';
import { AppViewType } from '@dvn/core/models/view-config';
import { dataConfigs } from '../data-configs';
import { spaces } from '../spaces';
export const ID = 'detail-view-error-log';
export const viewConfig = DetailViewConfig.decode({
  _id: ID,
  base: 'mentornity',
  space: spaces['mentornity'],
  table: dataConfigs['errorlogs'],
  title: 'Error Log',
  ui: {
    cardConfig: {
      body: {
        fields: [
          {
            fieldId: 'createdAt',
            fieldDisplay: new DateField('createdAt', 'Date').setDateFormat('DD.MM.YYYY HH:mm').setDataType(DateDataType.Unix),
          },
          {
            fieldId: 'user',
            fieldDisplay: new RawDataField('user._id', 'User ID'),
          },
          {
            fieldId: 'session',
            fieldDisplay: new RawDataField('session._id', 'Session ID'),
          },
          {
            fieldId: 'res',
          },
          {
            fieldId: 'status',
          },
          {
            fieldId: 'message',
          },
        ]
      },
    }
  },
  query: {
    filter: {
      comparison: Comparison.Eq,
      id: '_id',
      value: '$id',
    },
  },
  type: AppViewType.DetailViewCard,
  params: {
    id: {
      required: true,
    },
  },
});
