import { BooleanField } from '@dvn/core/doldurma/src/fields/boolean';
import { DataTransferField } from '@dvn/core/doldurma/src/fields/query-include/data-transfer-field';
import { FormViewConfig } from '@dvn/core/models/form-view-config';
import { AppViewType } from '@dvn/core/models/view-config';
import { EraseUserFormHandler } from '../../handlers/EraseUserFormHandler';
import { dataConfigs } from '../data-configs';
import { spaces } from '../spaces';
export const ID = 'form-view-user-erase';
export const viewConfig = FormViewConfig.decode({
  _id: ID,
  base: 'mentornity',
  title: 'Erasing User',
  space: spaces['mentornity'],
  table: dataConfigs['users'],
  type: AppViewType.FormView,
  handler: new EraseUserFormHandler(),
  ui: {
    fields: [
      // this field is passed by the parameters. this is a data holder field to pass the data to form handler
      {
        field: new DataTransferField('userId'),
      },
      {
        field: new BooleanField('confirmation', 'Erasure confirmation', 'Please confirm that you are aware of what you are doing. This action cannot be undone! All the user details and metadata are going to be erased and the user will receive a notification.').setErrorTitle('Confirmation').require(),
      },
    ],
  },
  params: {
    userId: {
      required: true,
    },
  },
});
