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

import { UserRouteAccessService } from 'app/core/auth/user-route-access.service';
import { ASC } from 'app/config/navigation.constants';
import { ContentPageComponent } from './list/content-page.component';
import { ContentPageDetailComponent } from './detail/content-page-detail.component';
import { ContentPageUpdateComponent } from './update/content-page-update.component';
import ContentPageResolve from './route/content-page-routing-resolve.service';

const contentPageRoute: Routes = [
  {
    path: '',
    component: ContentPageComponent,
    data: {
      defaultSort: 'id,' + ASC,
    },
    canActivate: [UserRouteAccessService],
  },
  {
    path: ':id/view',
    component: ContentPageDetailComponent,
    resolve: {
      contentPage: ContentPageResolve,
    },
    canActivate: [UserRouteAccessService],
  },
  {
    path: ':id/edit',
    component: ContentPageUpdateComponent,
    resolve: {
      contentPage: ContentPageResolve,
    },
    canActivate: [UserRouteAccessService],
  },
];

export default contentPageRoute;
