import { DataApiImpl } from '@dvn/core/api/dataApi';
import { AppConfig } from '@dvn/core/models/app-config';
import { getSessionData } from '@dvn/kimlik/index';
import { dataApiEndpoint } from '../constants/env';
import { membershipConfigs } from './membership-configs';
import { spaces } from './spaces';
import { detailViewErrorLog, detailViewFormResponse, detailViewOrganisation, detailViewUser, detailViewUserAuth, detailViewScheduledJobSendEmail, formViewUserErase, formViewOrganisationAdminAdd, formViewOrganisationAdminRemove, formViewOrganisationChangeDomain, formViewOrganisationConfigEdit, formViewOrganisationCreate, tableListViewErrorLogs, tableListViewErrorLogsAnonymous, tableListViewFormResponseContact, tableListViewFormResponseHelp, tableListViewOrganisation, tableListViewOrganisationAdmins, tableListViewScheduledJobSyncEventsInGoogle, tableListViewScheduledJobSyncEventsInMicrosoft, tableListViewScheduledJobSendEmail, tableListViewScheduledJobNextDaySummary, tableListViewScheduledJobDailySummary, tableListViewSession, tableListViewUser, tableListViewWhiteLabel, } from './view-configs';
const dataApi = new DataApiImpl(dataApiEndpoint, { Authorization: `Bearer ${getSessionData().token}` });
export const appConfigs = {
  // app for system admins
  'app-configs-system-admin': AppConfig.decode({
    _id: 'app-configs-system-admin',
    _created: new Date(),
    _updated: new Date(),
    mainContent: {
      centered: false,
    },
    mainNavigation: {
      items: [
        {
          ui: {
            icon: 'uil-building',
            title: 'Organisations',
          },
          viewId: tableListViewOrganisation.ID,
        },
        {
          ui: {
            icon: 'uil-clock',
            parent: 'Scheduled Jobs',
            title: 'Send Email'
          },
          viewId: tableListViewScheduledJobSendEmail.ID,
        },
        {
          ui: {
            icon: 'uil-clock',
            parent: 'Scheduled Jobs',
            title: 'Sync Google'
          },
          viewId: tableListViewScheduledJobSyncEventsInGoogle.ID,
        },
        {
          ui: {
            icon: 'uil-clock',
            parent: 'Scheduled Jobs',
            title: 'Sync Microsoft'
          },
          viewId: tableListViewScheduledJobSyncEventsInMicrosoft.ID,
        },
        {
          ui: {
            icon: 'uil-clock',
            parent: 'Scheduled Jobs',
            title: 'Next Day Summary'
          },
          viewId: tableListViewScheduledJobNextDaySummary.ID,
        },
        {
          ui: {
            icon: 'uil-clock',
            parent: 'Scheduled Jobs',
            title: 'Daily Summary'
          },
          viewId: tableListViewScheduledJobDailySummary.ID,
        },
        {
          ui: {
            icon: 'uil-signin',
            title: 'Sessions'
          },
          viewId: tableListViewSession.ID,
        },
        {
          ui: {
            icon: 'uil-file-alt',
            title: 'Contact',
            parent: 'Support Forms',
          },
          viewId: tableListViewFormResponseContact.ID,
        },
        {
          ui: {
            icon: 'uil-file-alt',
            title: 'Help',
            parent: 'Support Forms',
          },
          viewId: tableListViewFormResponseHelp.ID,
        },
        {
          ui: {
            icon: 'uil-user',
            title: 'Users'
          },
          viewId: tableListViewUser.ID,
        },
        {
          ui: {
            icon: 'uil-university',
            title: 'White Labels'
          },
          viewId: tableListViewWhiteLabel.ID,
        },
        {
          ui: {
            icon: 'uil-exclamation-triangle',
            title: 'User Errors',
            parent: 'Error Logs',
          },
          viewId: tableListViewErrorLogs.ID,
        },
        {
          ui: {
            icon: 'uil-exclamation-triangle',
            title: 'Anonymous Errors',
            parent: 'Error Logs',
          },
          viewId: tableListViewErrorLogsAnonymous.ID,
        },
      ],
      aligned: 'left',
    },
    membership: membershipConfigs['system-admins'],
    space: spaces['mentornity'],
    views: [
      detailViewErrorLog.viewConfig,
      detailViewFormResponse.viewConfig,
      detailViewOrganisation.viewConfig,
      detailViewUser.viewConfig,
      detailViewUserAuth.viewConfig,
      detailViewScheduledJobSendEmail.viewConfig,
      formViewUserErase.viewConfig,
      formViewOrganisationChangeDomain.viewConfig,
      formViewOrganisationConfigEdit.viewConfig,
      formViewOrganisationCreate.config(dataApi),
      formViewOrganisationAdminAdd.config(dataApi),
      formViewOrganisationAdminRemove.config(dataApi),
      tableListViewErrorLogs.config(dataApi),
      tableListViewErrorLogsAnonymous.viewConfig,
      tableListViewFormResponseContact.viewConfig,
      tableListViewFormResponseHelp.viewConfig,
      tableListViewOrganisation.viewConfig,
      tableListViewOrganisationAdmins.viewConfig,
      tableListViewScheduledJobDailySummary.viewConfig,
      tableListViewScheduledJobNextDaySummary.viewConfig,
      tableListViewScheduledJobSendEmail.viewConfig,
      tableListViewScheduledJobSyncEventsInGoogle.config(dataApi),
      tableListViewScheduledJobSyncEventsInMicrosoft.config(dataApi),
      tableListViewSession.config(dataApi),
      tableListViewUser.viewConfig,
      tableListViewWhiteLabel.viewConfig,
    ],
  }),
};
