import {
  createColumnLoader,
  ColumnMetadata,
} from '../DataGrid/configBuilderFactory';

const PUBLISH_EVENTS_COLUMNS: ColumnMetadata[] = [
  {
    field: 'project',
    headerName: 'Project',
    type: 'singleSelectRelation',
    entityRef: 'projects',
    editable: true,
  },
  {
    field: 'user',
    headerName: 'User',
    type: 'singleSelectRelation',
    entityRef: 'users',
    editable: true,
  },
  {
    field: 'from_environment',
    headerName: 'Fromenvironment',
    type: 'text',
    editable: true,
  },
  {
    field: 'to_environment',
    headerName: 'Toenvironment',
    type: 'text',
    editable: true,
  },
  {
    field: 'started_at',
    headerName: 'Startedat',
    type: 'datetime',
    editable: true,
  },
  {
    field: 'finished_at',
    headerName: 'Finishedat',
    type: 'datetime',
    editable: true,
  },
  {
    field: 'title',
    headerName: 'Title',
    type: 'text',
    editable: true,
    minWidth: 160,
  },
  {
    field: 'description',
    headerName: 'Description',
    type: 'text',
    editable: true,
    minWidth: 220,
  },
  { field: 'status', headerName: 'Status', type: 'text', editable: true },
  {
    field: 'error_message',
    headerName: 'Errormessage',
    type: 'text',
    editable: true,
  },
  {
    field: 'pages_copied',
    headerName: 'Pagescopied',
    type: 'number',
    editable: true,
  },
  {
    field: 'transitions_copied',
    headerName: 'Transitionscopied',
    type: 'number',
    editable: true,
  },
  {
    field: 'audios_copied',
    headerName: 'Audioscopied',
    type: 'number',
    editable: true,
  },
  { field: 'actions', headerName: '', type: 'actions' },
];

export const loadColumns = createColumnLoader({
  entityName: 'publish_events',
  columns: PUBLISH_EVENTS_COLUMNS,
});
