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

import { UserRouteAccessService } from 'app/core/auth/user-route-access.service';
import { ASC } from 'app/config/navigation.constants';
import { VariableClassTypeComponent } from './list/variable-class-type.component';
import { VariableClassTypeDetailComponent } from './detail/variable-class-type-detail.component';
import { VariableClassTypeUpdateComponent } from './update/variable-class-type-update.component';
import VariableClassTypeResolve from './route/variable-class-type-routing-resolve.service';
import { SecurityAction } from 'app/security/security-action.model';
import { VariableClassTypeService } from './service/variable-class-type.service';
import { Resources } from 'app/security/resources.model';

const variableClassTypeRoute: Routes = [
  {
    path: '',
    component: VariableClassTypeComponent,
    canActivate: [UserRouteAccessService],
    data: {
      defaultSort: 'id,' + ASC,
      action: SecurityAction.READ,
      service: VariableClassTypeService,
      resource: Resources.VARIABLE_CLASS_TYPE,
      authorities: ['ROLE_ADMIN', 'ROLE_MANAGER'],
    }
  },
  {
    path: ':id/view',
    component: VariableClassTypeDetailComponent,
    resolve: {
      variableClassType: VariableClassTypeResolve,
    },
    canActivate: [UserRouteAccessService],
    data: {
      action: SecurityAction.READ,
      service: VariableClassTypeService,
      resource: Resources.VARIABLE_CLASS_TYPE,
      authorities: ['ROLE_ADMIN', 'ROLE_MANAGER'],
    }
  },
  {
    path: 'new',
    component: VariableClassTypeUpdateComponent,
    resolve: {
      variableClassType: VariableClassTypeResolve,
    },
    canActivate: [UserRouteAccessService],
    data: {
      action: SecurityAction.CREATE,
      service: VariableClassTypeService,
      resource: Resources.VARIABLE_CLASS_TYPE,
      authorities: ['ROLE_ADMIN', 'ROLE_MANAGER'],
    }
  },
  {
    path: ':id/edit',
    component: VariableClassTypeUpdateComponent,
    resolve: {
      variableClassType: VariableClassTypeResolve,
    },
    canActivate: [UserRouteAccessService],
    data: {
      action: SecurityAction.UPDATE,
      service: VariableClassTypeService,
      resource: Resources.VARIABLE_CLASS_TYPE,
      authorities: ['ROLE_ADMIN', 'ROLE_MANAGER'],
    }
  },
];

export default variableClassTypeRoute;
