import {
  Route,
  Routes,
} from '@angular/router';

import { environment } from '../../environments/environment';
import { i18nBreadcrumbResolver } from '../core/breadcrumbs/i18n-breadcrumb.resolver';
import { notifyInfoGuard } from '../core/coar-notify/notify-info/notify-info.guard';
import { feedbackGuard } from '../core/feedback/feedback.guard';
import { hasValue } from '../shared/empty.util';
import { ThemedEndUserAgreementComponent } from './end-user-agreement/themed-end-user-agreement.component';
import { ThemedFeedbackComponent } from './feedback/themed-feedback.component';
import {
  COAR_NOTIFY_SUPPORT,
  END_USER_AGREEMENT_PATH,
  FEEDBACK_PATH,
  PRIVACY_PATH,
  IMPRINT_PATH,
  FAQ_PATH,
  OVERVIEW_PATH,
  NEWFEATURES_PATH,
  STATISTICS_PATH,
} from './info-routing-paths';
import { NotifyInfoComponent } from './notify-info/notify-info.component';
import { ThemedPrivacyComponent } from './privacy/themed-privacy.component';
// GI Specifics
import { ThemedImprintComponent } from './imprint/themed-imprint.component';
import { ThemedFaqComponent } from './faq/themed-faq.component';
import { ThemedOverviewComponent } from './overview/themed-overview.component';
import { ThemedNewFeaturesComponent } from './newfeatures/themed-newfeatures.component';
import { ThemedStatisticsComponent } from './statistics/themed-statistics.component';
// End GI Specifics


export const ROUTES: Routes = [
  {
    path: FEEDBACK_PATH,
    component: ThemedFeedbackComponent,
    resolve: { breadcrumb: i18nBreadcrumbResolver },
    data: { title: 'info.feedback.title', breadcrumbKey: 'info.feedback' },
    canActivate: [feedbackGuard],
  },
// GI Specifics
  {
    path: IMPRINT_PATH,
    component: ThemedImprintComponent,
    resolve: { breadcrumb: i18nBreadcrumbResolver },
    data: { title: 'info.imprint.title', breadcrumbKey: 'info.imprint' },
  },
  {
    path: FAQ_PATH,
    component: ThemedFaqComponent,
    resolve: { breadcrumb: i18nBreadcrumbResolver },
    data: { title: 'info.faq.title', breadcrumbKey: 'info.faq' },
  },
  {
    path: OVERVIEW_PATH,
    component: ThemedOverviewComponent,
    resolve: { breadcrumb: i18nBreadcrumbResolver },
    data: { title: 'info.overview.title', breadcrumbKey: 'info.overview' },
  },
  {
    path: NEWFEATURES_PATH,
    component: ThemedNewFeaturesComponent,
    resolve: { breadcrumb: i18nBreadcrumbResolver },
    data: { title: 'info.newfeatures.title', breadcrumbKey: 'info.newfeatures' },
  },
  {
    path: STATISTICS_PATH,
    component: ThemedStatisticsComponent,
    resolve: { breadcrumb: i18nBreadcrumbResolver },
    data: { title: 'info.statistics.title', breadcrumbKey: 'info.statistics' },
  },
// End GI Specifics
  environment.info.enableEndUserAgreement ? {
    path: END_USER_AGREEMENT_PATH,
    component: ThemedEndUserAgreementComponent,
    resolve: { breadcrumb: i18nBreadcrumbResolver },
    data: { title: 'info.end-user-agreement.title', breadcrumbKey: 'info.end-user-agreement' },
  } : undefined,
  environment.info.enablePrivacyStatement ? {
    path: PRIVACY_PATH,
    component: ThemedPrivacyComponent,
    resolve: { breadcrumb: i18nBreadcrumbResolver },
    data: { title: 'info.privacy.title', breadcrumbKey: 'info.privacy' },
  } : undefined,
  environment.info.enableCOARNotifySupport ? {
    path: COAR_NOTIFY_SUPPORT,
    component: NotifyInfoComponent,
    canActivate: [notifyInfoGuard],
    resolve: {
      breadcrumb: i18nBreadcrumbResolver,
    },
    data: {
      title: 'info.coar-notify-support.title',
      breadcrumbKey: 'info.coar-notify-support',
    },
  } : undefined,
].filter((route: Route) => hasValue(route));