/**
 * Created by stefania on 9/16/16.
 */
import { ModuleWithProviders }  from '@angular/core';
import { Routes, RouterModule } from '@angular/router';

import { DashboardComponent } from "./dashboard.component";
import { CommunitiesComponent } from './pages/community/communities.component';
import { CommunityEditFormComponent } from "./pages/community/community-edit-form/community-edit-form.component";
import { EntitiesComponent } from "./pages/entity/entities.component";
import { PagesComponent } from "./pages/page/pages.component";
import { PageHelpContentsComponent } from "./pages/helpcontent/page-help-contents.component";
import { NewPageHelpContentComponent } from "./pages/helpcontent/new-page-help-content.component";
import { EditPageHelpContentComponent } from "./pages/helpcontent/edit-page-help-content.component";
import { DivIdsComponent } from "./pages/divId/divIds.component";
import { DivHelpContentsComponent } from "./pages/divhelpcontent/div-help-contents.component";
import { NewDivHelpContentComponent } from "./pages/divhelpcontent/new-div-help-content.component";
import { EditDivHelpContentComponent } from "./pages/divhelpcontent/edit-div-help-content.component";
import {ClaimsComponent} from './pages/claims/claims.component';
import {FreeGuard} from './openaireLibrary/login/freeGuard.guard';

import { AdminLoginGuard} from './openaireLibrary/login/adminLoginGuard.guard';
import { ConnectAdminLoginGuard} from './openaireLibrary/login/connectAdminLoginGuard.guard';

import { EnvironmentSpecificResolver} from './openaireLibrary/utils/properties/environmentSpecificResolver';
import { EnvironmentSpecificService} from './openaireLibrary/utils/properties/environment-specific.service';
import{ClaimsAdminComponent} from './openaireLibrary/claims/claimsAdmin/claimsAdmin.component';

import {StatsComponent} from "./pages/stats/stats.component";

//TODO replace FreeGuard with ConnectAdminLoginGuard

const appRoutes: Routes = [
    {
        path: '',
        redirectTo: 'dashboard',
        pathMatch: 'full'
    },
    {
        path: 'dashboard',
        component: DashboardComponent,
        canActivate: [FreeGuard],resolve: { envSpecific: EnvironmentSpecificResolver  }
    },

    {
      path: 'communities',
      component: CommunitiesComponent,
      canActivate: [FreeGuard],resolve: { envSpecific: EnvironmentSpecificResolver  }
    },
    {
      path: 'community-edit-form',
      component: CommunityEditFormComponent,
      canActivate: [FreeGuard],resolve: { envSpecific: EnvironmentSpecificResolver  }
    },
    {
      path: 'entities',
      component: EntitiesComponent,
      canActivate: [FreeGuard],resolve: { envSpecific: EnvironmentSpecificResolver  }
    },
    {
      path: 'classes',
      component: DivIdsComponent,canActivate: [FreeGuard],resolve: { envSpecific: EnvironmentSpecificResolver  }
    },
    {
        path: 'pages',
        component: PagesComponent,
        canActivate: [FreeGuard],resolve: { envSpecific: EnvironmentSpecificResolver  }
    },
    {
        path: 'pageContents',
        component: PageHelpContentsComponent,
        canActivate: [FreeGuard],resolve: { envSpecific: EnvironmentSpecificResolver  }
    },
    {
        path: 'pageContents/new',
        component: NewPageHelpContentComponent,
        canActivate: [FreeGuard],resolve: { envSpecific: EnvironmentSpecificResolver  }
    },
    {
        //path: 'pageContents/edit/:id',
        path: 'pageContents/edit',
        component: EditPageHelpContentComponent,
         canActivate: [FreeGuard],resolve: { envSpecific: EnvironmentSpecificResolver  }
    },

    {
        path: 'classContents',
        component: DivHelpContentsComponent,canActivate: [FreeGuard],resolve: { envSpecific: EnvironmentSpecificResolver  }
    },
    {
        path: 'classContents/new',
        component: NewDivHelpContentComponent,canActivate: [FreeGuard],resolve: { envSpecific: EnvironmentSpecificResolver  }
    },
    {
        path: 'classContents/edit',
        component: EditDivHelpContentComponent,canActivate: [FreeGuard],resolve: { envSpecific: EnvironmentSpecificResolver  }
    },
    {
        path: 'claims',
        component: ClaimsComponent,canActivate: [FreeGuard],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',
        component: StatsComponent,
        canActivate: [FreeGuard],
        resolve: { envSpecific: EnvironmentSpecificResolver  }
    },
    { path: '**',pathMatch: 'full',component: DashboardComponent }

 ];
 // @NgModule({
 //   imports: [RouterModule.forRoot(appRoutes)],
 //   exports: [RouterModule],
 //   providers: [EnvironmentSpecificResolver, EnvironmentSpecificService]
 // })
export const appRoutingProviders: any[] = [
];

export const routing: ModuleWithProviders = RouterModule.forRoot(appRoutes);
