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 { GoalFormComponent } from './views/goal-form.component';
//import { CalendarFormComponent } from './calendar-form/calendar-form.component';

const routes: Routes = [
  {
    path: '', component: CrudGridComponent, canActivate: [AuthGuard, ResourceAuthGuard],
    resolve: { template: TemplateResolver },
    data: {
      innerTemplate: 'none',
      program: 'goal',
      breadcrumb: 'breadcrumb.goal'
    }
  },
  {
    path: 'detail/:mode', component: GoalFormComponent, canActivate: [AuthGuard, ResourceAuthGuard], canDeactivate: [DirtyGuard],
    resolve: { record: RecordResolver },
    data: {
        innerTemplate: 'none',
        program: 'goal',
        breadcrumb: 'breadcrumb.goal',
      },
      children: [
        {
          path: '', component: CrudGridComponent, canActivate: [AuthGuard, ResourceAuthGuard],
          resolve: { record: RecordResolver, goalaction: TemplateResolver },
          data: {
            innerTemplate: 'none',
            program: 'GOALFORACTIONS',
            breadcrumb: 'breadcrumb.goal-action.detail',
          }
        },
        {
          path: '', component: CrudGridComponent, canActivate: [AuthGuard, ResourceAuthGuard],
          resolve: { record: RecordResolver, goalaction: TemplateResolver },
          data: {
            innerTemplate: 'none',
            program: 'a',
            breadcrumb: 'breadcrumb.goal-action.detail',
          }
        },
      ]

  },
  

];

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