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

import { UserRouteAccessService } from 'app/core/auth/user-route-access.service';
import { ASC } from 'app/config/navigation.constants';
import { OrganizationTypeComponent } from './list/organization-type.component';
import { OrganizationTypeDetailComponent } from './detail/organization-type-detail.component';
import { OrganizationTypeUpdateComponent } from './update/organization-type-update.component';
import OrganizationTypeResolve from './route/organization-type-routing-resolve.service';
import { Resources } from 'app/security/resources.model';
import { OrganizationTypeService } from './service/organization-type.service';
import { SecurityAction } from 'app/security/security-action.model';

const organizationTypeRoute: Routes = [
  {
    path: '',
    component: OrganizationTypeComponent,
    canActivate: [UserRouteAccessService],
    data: {
      defaultSort: 'id,' + ASC,
      action: SecurityAction.READ,
      service: OrganizationTypeService,
      resource: Resources.ORGANIZATION_TYPE,
      authorities: ['ROLE_ADMIN', 'ROLE_MANAGER'],
    }
  },
  {
    path: ':id/view',
    component: OrganizationTypeDetailComponent,
    resolve: {
      organizationType: OrganizationTypeResolve,
    },
    canActivate: [UserRouteAccessService],
    data: {
      action: SecurityAction.READ,
      service: OrganizationTypeService,
      resource: Resources.ORGANIZATION_TYPE,
      authorities: ['ROLE_ADMIN', 'ROLE_MANAGER'],
    }
  },
  {
    path: 'new',
    component: OrganizationTypeUpdateComponent,
    resolve: {
      organizationType: OrganizationTypeResolve,
    },
    canActivate: [UserRouteAccessService],
    data: {
      action: SecurityAction.CREATE,
      service: OrganizationTypeService,
      resource: Resources.ORGANIZATION_TYPE,
      authorities: ['ROLE_ADMIN', 'ROLE_MANAGER'],
    }
  },
  {
    path: ':id/edit',
    component: OrganizationTypeUpdateComponent,
    resolve: {
      organizationType: OrganizationTypeResolve,
    },
    canActivate: [UserRouteAccessService],
    data: {
      action: SecurityAction.UPDATE,
      service: OrganizationTypeService,
      resource: Resources.ORGANIZATION_TYPE,
      authorities: ['ROLE_ADMIN', 'ROLE_MANAGER'],
    }
  },
];

export default organizationTypeRoute;
