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

import { UserRouteAccessService } from 'app/core/auth/user-route-access.service';
import { ASC } from 'app/config/navigation.constants';
import { OutputDataComponent } from './list/output-data.component';
import { OutputDataDetailComponent } from './detail/output-data-detail.component';
import OutputDataResolve from './route/output-data-routing-resolve.service';
import { SecurityAction } from 'app/security/security-action.model';
import { OutputDataService } from './service/output-data.service';
import { Resources } from 'app/security/resources.model';

const outputDataRoute: Routes = [
  {
    path: '',
    component: OutputDataComponent,
    canActivate: [UserRouteAccessService],
    data: {
      defaultSort: 'id,' + ASC,
      action: SecurityAction.READ,
      service: OutputDataService,
      resource: Resources.OUTPUT_DATA,
      authorities: ['ROLE_ADMIN', 'ROLE_MANAGER', 'ROLE_COORDINATOR'],
    }
  },
  {
    path: ':id/view',
    component: OutputDataDetailComponent,
    resolve: {
      outputData: OutputDataResolve,
    },
    canActivate: [UserRouteAccessService],
    data: {
      action: SecurityAction.READ,
      service: OutputDataService,
      resource: Resources.OUTPUT_DATA,
      authorities: ['ROLE_ADMIN', 'ROLE_MANAGER', 'ROLE_COORDINATOR'],
    }
  },
];

export default outputDataRoute;
