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

import { UserRouteAccessService } from 'app/core/auth/user-route-access.service';
import { ASC } from 'app/config/navigation.constants';
import { UnitConverterComponent } from './list/unit-converter.component';
import { UnitConverterDetailComponent } from './detail/unit-converter-detail.component';
import { UnitConverterUpdateComponent } from './update/unit-converter-update.component';
import UnitConverterResolve from './route/unit-converter-routing-resolve.service';
import { SecurityAction } from 'app/security/security-action.model';
import { UnitConverterService } from './service/unit-converter.service';
import { Resources } from 'app/security/resources.model';

const unitConverterRoute: Routes = [
  {
    path: '',
    component: UnitConverterComponent,
    canActivate: [UserRouteAccessService],
    data: {
      defaultSort: 'id,' + ASC,
      action: SecurityAction.READ,
      service: UnitConverterService,
      resource: Resources.UNIT_CONVERTER,
      authorities: ['ROLE_ADMIN', 'ROLE_MANAGER'],
    }
  },
  {
    path: ':id/view',
    component: UnitConverterDetailComponent,
    resolve: {
      unitConverter: UnitConverterResolve,
    },
    canActivate: [UserRouteAccessService],
    data: {
      action: SecurityAction.READ,
      service: UnitConverterService,
      resource: Resources.UNIT_CONVERTER,
      authorities: ['ROLE_ADMIN', 'ROLE_MANAGER'],
    }
  },
  {
    path: 'new',
    component: UnitConverterUpdateComponent,
    resolve: {
      unitConverter: UnitConverterResolve,
    },
    canActivate: [UserRouteAccessService],
    data: {
      action: SecurityAction.CREATE,
      service: UnitConverterService,
      resource: Resources.UNIT_CONVERTER,
      authorities: ['ROLE_ADMIN', 'ROLE_MANAGER'],
    }
  },
  {
    path: ':id/edit',
    component: UnitConverterUpdateComponent,
    resolve: {
      unitConverter: UnitConverterResolve,
    },
    canActivate: [UserRouteAccessService],
    data: {
      action: SecurityAction.UPDATE,
      service: UnitConverterService,
      resource: Resources.UNIT_CONVERTER,
      authorities: ['ROLE_ADMIN', 'ROLE_MANAGER'],
    }
  },
];

export default unitConverterRoute;
