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

import { UserRouteAccessService } from 'app/core/auth/user-route-access.service';
import { ASC } from 'app/config/navigation.constants';
import { InputDataComponent } from './list/input-data.component';
import { InputDataDetailComponent } from './detail/input-data-detail.component';
import { InputDataUpdateComponent } from './update/input-data-update.component';
import InputDataResolve from './route/input-data-routing-resolve.service';
import { SecurityAction } from 'app/security/security-action.model';
import { Resources } from 'app/security/resources.model';
import { InputDataService } from './service/input-data.service';

const inputDataRoute: Routes = [
  {
    path: '',
    component: InputDataComponent,
    canActivate: [UserRouteAccessService],
    data: {
      defaultSort: 'id,' + ASC,
      action: SecurityAction.READ,
      service: InputDataService,
      resource: Resources.INPUT_DATA,
      authorities: ['ROLE_ADMIN', 'ROLE_MANAGER', 'ROLE_COORDINATOR'],
    }
  },
  {
    path: ':id/view',
    component: InputDataDetailComponent,
    resolve: {
      inputData: InputDataResolve,
    },
    canActivate: [UserRouteAccessService],
    data: {
      action: SecurityAction.READ,
      service: InputDataService,
      resource: Resources.INPUT_DATA,
      authorities: ['ROLE_ADMIN', 'ROLE_MANAGER', 'ROLE_COORDINATOR'],
    }
  },
  {
    path: 'new',
    component: InputDataUpdateComponent,
    resolve: {
      inputData: InputDataResolve,
    },
    canActivate: [UserRouteAccessService],
    data: {
      action: SecurityAction.CREATE,
      service: InputDataService,
      resource: Resources.INPUT_DATA,
      authorities: ['ROLE_ADMIN', 'ROLE_MANAGER', 'ROLE_COORDINATOR'],
    }
  },
  {
    path: ':id/edit',
    component: InputDataUpdateComponent,
    resolve: {
      inputData: InputDataResolve,
    },
    canActivate: [UserRouteAccessService],
    data: {
      action: SecurityAction.UPDATE,
      service: InputDataService,
      resource: Resources.INPUT_DATA,
      authorities: ['ROLE_ADMIN', 'ROLE_MANAGER', 'ROLE_COORDINATOR'],
    }
  },
];

export default inputDataRoute;
