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

import { UserRouteAccessService } from 'app/core/auth/user-route-access.service';
import { ASC } from 'app/config/navigation.constants';
import { MetadataValueComponent } from './list/metadata-value.component';
import { MetadataValueDetailComponent } from './detail/metadata-value-detail.component';
import { MetadataValueUpdateComponent } from './update/metadata-value-update.component';
import MetadataValueResolve from './route/metadata-value-routing-resolve.service';
import { SecurityAction } from 'app/security/security-action.model';
import { MetadataValueService } from './service/metadata-value.service';
import { Resources } from 'app/security/resources.model';

const metadataValueRoute: Routes = [
  {
    path: '',
    component: MetadataValueComponent,
    canActivate: [UserRouteAccessService],
    data: {
      defaultSort: 'id,' + ASC,
      action: SecurityAction.READ,
      service: MetadataValueService,
      resource: Resources.METADATA_VALUE,
      authorities: ['ROLE_ADMIN', 'ROLE_MANAGER'],
    }
  },
  {
    path: ':id/view',
    component: MetadataValueDetailComponent,
    resolve: {
      metadataValue: MetadataValueResolve,
    },
    canActivate: [UserRouteAccessService],
    data: {
      action: SecurityAction.READ,
      service: MetadataValueService,
      resource: Resources.METADATA_VALUE,
      authorities: ['ROLE_ADMIN', 'ROLE_MANAGER'],
    }
  },
  {
    path: 'new',
    component: MetadataValueUpdateComponent,
    resolve: {
      metadataValue: MetadataValueResolve,
    },
    canActivate: [UserRouteAccessService],
    data: {
      action: SecurityAction.CREATE,
      service: MetadataValueService,
      resource: Resources.METADATA_VALUE,
      authorities: ['ROLE_ADMIN', 'ROLE_MANAGER'],
    }
  },
  {
    path: ':id/edit',
    component: MetadataValueUpdateComponent,
    resolve: {
      metadataValue: MetadataValueResolve,
    },
    canActivate: [UserRouteAccessService],
    data: {
      action: SecurityAction.UPDATE,
      service: MetadataValueService,
      resource: Resources.METADATA_VALUE,
      authorities: ['ROLE_ADMIN', 'ROLE_MANAGER'],
    }
  },
];

export default metadataValueRoute;
