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

import { UserRouteAccessService } from 'app/core/auth/user-route-access.service';
import { ASC } from 'app/config/navigation.constants';
import { VariableScopeComponent } from './list/variable-scope.component';
import { VariableScopeDetailComponent } from './detail/variable-scope-detail.component';
import { VariableScopeUpdateComponent } from './update/variable-scope-update.component';
import VariableScopeResolve from './route/variable-scope-routing-resolve.service';
import { SecurityAction } from 'app/security/security-action.model';
import { VariableScopeService } from './service/variable-scope.service';
import { Resources } from 'app/security/resources.model';

const variableScopeRoute: Routes = [
  {
    path: '',
    component: VariableScopeComponent,
    canActivate: [UserRouteAccessService],
    data: {
      defaultSort: 'id,' + ASC,
      action: SecurityAction.READ,
      service: VariableScopeService,
      resource: Resources.VARIABLE_SCOPE,
      authorities: ['ROLE_ADMIN', 'ROLE_MANAGER'],
    }
  },
  {
    path: ':id/view',
    component: VariableScopeDetailComponent,
    resolve: {
      variableScope: VariableScopeResolve,
    },
    canActivate: [UserRouteAccessService],
    data: {
      action: SecurityAction.READ,
      service: VariableScopeService,
      resource: Resources.VARIABLE_SCOPE,
      authorities: ['ROLE_ADMIN', 'ROLE_MANAGER'],
    }
  },
  {
    path: 'new',
    component: VariableScopeUpdateComponent,
    resolve: {
      variableScope: VariableScopeResolve,
    },
    canActivate: [UserRouteAccessService],
    data: {
      action: SecurityAction.CREATE,
      service: VariableScopeService,
      resource: Resources.VARIABLE_SCOPE,
      authorities: ['ROLE_ADMIN', 'ROLE_MANAGER'],
    }
  },
  {
    path: ':id/edit',
    component: VariableScopeUpdateComponent,
    resolve: {
      variableScope: VariableScopeResolve,
    },
    canActivate: [UserRouteAccessService],
    data: {
      action: SecurityAction.READ,
      service: VariableScopeService,
      resource: Resources.VARIABLE_SCOPE,
      authorities: ['ROLE_ADMIN', 'ROLE_MANAGER'],
    }
  },
];

export default variableScopeRoute;
