/**
 * Created by stefania on 9/16/16.
 */
import { NgModule} from '@angular/core';
import { Routes, RouterModule} from '@angular/router';
import {IsCommunity} from './openaireLibrary/connect/communityGuard/isCommunity.guard';
import {ConnectAdminLoginGuard} from './openaireLibrary/connect/communityGuard/connectAdminLoginGuard.guard';
import {ConnectRIGuard} from './openaireLibrary/connect/communityGuard/connectRIGuard.guard';

import {EnvironmentSpecificResolver} from './openaireLibrary/utils/properties/environmentSpecificResolver';

import {CommunityErrorPageComponent} from './openaireLibrary/connect/communityGuard/communityErrorPage.component';
import {AdminErrorPageComponent} from './pages/error/errorPage.component';

const appRoutes: Routes = [
    {
        path: '',
        loadChildren: './pages/wellcome/wellcome.module#WellcomeModule',
        resolve: { envSpecific: EnvironmentSpecificResolver }
    },
    {
        path: 'dashboard',
        loadChildren: './pages/dashboard/dashboard.module#DashboardModule',
        resolve: {envSpecific: EnvironmentSpecificResolver}
    },
    {
        path: 'manage-user-notifications',
        loadChildren: './pages/usernotifications/manage-user-notifications.module#ManageUserNotificationsModule',
        resolve: {envSpecific: EnvironmentSpecificResolver}
    },
    {
        path: 'personal',
        loadChildren: './pages/curator/curator.module#CuratorModule',
        resolve: { envSpecific: EnvironmentSpecificResolver  }
    },
    {
      path: 'organizations',
      loadChildren: './pages/affiliations/affiliations.module#AffiliationsModule',
      resolve: { envSpecific: EnvironmentSpecificResolver  }
    },
    {
        path: 'communities',
        loadChildren: './pages/community/communities.module#CommunitiesModule',
        resolve: { envSpecific: EnvironmentSpecificResolver  }
    },
    {
        path: 'community-edit-form',
        loadChildren: './pages/community/community-edit-form/community-edit-form.module#CommunityEditFormModule',
        resolve: { envSpecific: EnvironmentSpecificResolver  }
    },
    {
        path: 'manage-zenodo-communities',
        loadChildren: './pages/zenodo-communities/zenodo-communities.module#ZenodoCommunitiesModule',
        resolve: { envSpecific: EnvironmentSpecificResolver  }
    },
    {
        path: 'manage-subscribers',
        loadChildren: './pages/subscribers/manage-subscribers.module#ManageSubscribersModule',
        resolve: { envSpecific: EnvironmentSpecificResolver  }
    },
    {
        path: 'manage-subjects',
        loadChildren: './pages/subjects/subjects-edit-form/subjects-edit-form.module#SubjectsEditFormModule',
        resolve: { envSpecific: EnvironmentSpecificResolver  }
    },
    {
        path: 'entities',
        loadChildren: './pages/entity/entities.module#EntitiesModule',
        resolve: { envSpecific: EnvironmentSpecificResolver  }
    },
    {
        path: 'classes',
        loadChildren: './pages/divId/divIds.module#DivIdsModule',
        resolve: { envSpecific: EnvironmentSpecificResolver  }
    },
    {
        path: 'pages',
        loadChildren: './pages/page/pages.module#PagesModule',
        resolve: { envSpecific: EnvironmentSpecificResolver  }
    },
    {
        path: 'pageContents',
        loadChildren: './pages/helpcontent/page-help-contents.module#PageHelpContentsModule',
        resolve: { envSpecific: EnvironmentSpecificResolver  }
    },
    {
        path: 'pageContents/new',
        loadChildren: './pages/helpcontent/new-page-help-content.module#NewPageHelpContentModule',
        resolve: { envSpecific: EnvironmentSpecificResolver  }
    },
    {
        path: 'pageContents/edit',
        loadChildren: './pages/helpcontent/edit-page-help-content.module#EditPageHelpContentModule',
        resolve: { envSpecific: EnvironmentSpecificResolver  }
    },
    {
        path: 'classContents',
        loadChildren: './pages/divhelpcontent/div-help-contents.module#DivHelpContentsModule',
        resolve: { envSpecific: EnvironmentSpecificResolver  }
    },
    {
        path: 'classContents/new',
        loadChildren: './pages/divhelpcontent/new-div-help-content.module#NewDivHelpContentModule',
        resolve: { envSpecific: EnvironmentSpecificResolver  }
    },
    {
        path: 'classContents/edit',
        loadChildren: './pages/divhelpcontent/edit-div-help-content.module#EditDivHelpContentModule',
        resolve: { envSpecific: EnvironmentSpecificResolver  }
    },
    {
        path: 'htmlPageContent/edit',
        loadChildren: './pages/htmlpagecontent/edit-html-page-content.module#EditHtmlPageContentModule',
        resolve: { envSpecific: EnvironmentSpecificResolver  }
    },
    {
        path: 'claims',
        loadChildren: './pages/claims/claims.module#ClaimsModule',
        resolve: { envSpecific: EnvironmentSpecificResolver  }
    },
    {
        path: 'reload',
        loadChildren: './reload/libReload.module#LibReloadModule',
        resolve: { envSpecific: EnvironmentSpecificResolver  }
    },
    {
        path: 'user-info',
        loadChildren: './login/libUser.module#LibUserModule',
        resolve: { envSpecific: EnvironmentSpecificResolver  }
    },
    {
        path: 'stats',
        loadChildren: './pages/stats/stats.module#StatsModule',
        resolve: { envSpecific: EnvironmentSpecificResolver  }
    },
    {
        path: 'manage-projects',
        loadChildren: './pages/community/projects/communityProjects.module#CommunityProjectsModule',
        resolve: { envSpecific: EnvironmentSpecificResolver  }
    },
    {
        path: 'manage-content-providers',
        loadChildren: './pages/community/content-providers/communityContentProviders.module#CommunityContentProvidersModule',
        resolve: { envSpecific: EnvironmentSpecificResolver  }
    },
    /*{
        path: 'customize-layout',
        loadChildren: './pages/customization/customization.module#CustomizationModule',
        resolve: { envSpecific: EnvironmentSpecificResolver  }
    },*/
    {
        path: 'manage-content-providers/criteria',
        loadChildren: './pages/community/content-providers/criteria/criteria.module#CriteriaModule',
        resolve: { envSpecific: EnvironmentSpecificResolver  }
    },
    {
        path: 'mining',
        loadChildren: './pages/mining/mining.module#MiningModule',
        canLoad: [IsCommunity, ConnectAdminLoginGuard, ConnectRIGuard]
    },
    {
        path: 'errorcommunity',
        component: CommunityErrorPageComponent
    },
    {   path: '**',
        pathMatch: 'full',
        component: AdminErrorPageComponent
    }

 ];

@NgModule({
    imports: [ RouterModule.forRoot(appRoutes) ],
    exports: [ RouterModule ]
})
export class AppRoutingModule {}
