import { NgModule } from '@angular/core';
import { Routes, RouterModule } from '@angular/router';
import { AuthGuard } from '@xdf/security';
import { TemplateResolver, DirtyGuard, CrudGridComponent, RecordResolver } from '@xdf/gallery';
import { ResourceAuthGuard } from '@xdf/security';
import { BusinessParametersFormComponent } from './views/business-parameters-form.component';

const routes: Routes = [
  {
    path: '', component: CrudGridComponent, canActivate: [AuthGuard, ResourceAuthGuard], 
    resolve: { template: TemplateResolver },
    data: {
      innerTemplate: 'none',
      program: 'BUSINESS-PARAMETERS',
      breadcrumb: 'breadcrumb.business-parameters'
    }
  },
  {
    path: 'detail/:mode', component: BusinessParametersFormComponent, canActivate: [AuthGuard, ResourceAuthGuard], canDeactivate: [DirtyGuard],
    resolve: { record: RecordResolver },
    data: {
      program: 'BUSINESS-PARAMETERS',
      breadcrumb: 'breadcrumb.business-parameters.detail'
    }
  }
];

@NgModule({
  imports: [RouterModule.forChild(routes)],
  exports: [RouterModule]
})
export class BusinessParametersRoutingModule { }