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

import { UserRouteAccessService } from 'app/core/auth/user-route-access.service';
import { ASC } from 'app/config/navigation.constants';
import { MetadataPropertyComponent } from './list/metadata-property.component';
import { MetadataPropertyDetailComponent } from './detail/metadata-property-detail.component';
import { MetadataPropertyUpdateComponent } from './update/metadata-property-update.component';
import MetadataPropertyResolve from './route/metadata-property-routing-resolve.service';
import { SecurityAction } from 'app/security/security-action.model';
import { MetadataPropertyService } from './service/metadata-property.service';
import { Resources } from 'app/security/resources.model';

const metadataPropertyRoute: Routes = [
  {
    path: '',
    component: MetadataPropertyComponent,
    canActivate: [UserRouteAccessService],
    data: {
      defaultSort: 'id,' + ASC,
      action: SecurityAction.READ,
      service: MetadataPropertyService,
      resource: Resources.METADATA_PROPERTY,
      authorities: ['ROLE_ADMIN', 'ROLE_MANAGER'],
    }
  },
  {
    path: ':id/view',
    component: MetadataPropertyDetailComponent,
    resolve: {
      metadataProperty: MetadataPropertyResolve,
    },
    canActivate: [UserRouteAccessService],
    data: {
      action: SecurityAction.READ,
      service: MetadataPropertyService,
      resource: Resources.METADATA_PROPERTY,
      authorities: ['ROLE_ADMIN', 'ROLE_MANAGER'],
    }
  },
  {
    path: 'new',
    component: MetadataPropertyUpdateComponent,
    resolve: {
      metadataProperty: MetadataPropertyResolve,
    },
    canActivate: [UserRouteAccessService],
    data: {
      action: SecurityAction.CREATE,
      service: MetadataPropertyService,
      resource: Resources.METADATA_PROPERTY,
      authorities: ['ROLE_ADMIN', 'ROLE_MANAGER'],
    }
  },
  {
    path: ':id/edit',
    component: MetadataPropertyUpdateComponent,
    resolve: {
      metadataProperty: MetadataPropertyResolve,
    },
    canActivate: [UserRouteAccessService],
    data: {
      action: SecurityAction.UPDATE,
      service: MetadataPropertyService,
      resource: Resources.METADATA_PROPERTY,
      authorities: ['ROLE_ADMIN', 'ROLE_MANAGER'],
    }
  },
];

export default metadataPropertyRoute;
