import { NgModule } from "@angular/core";
import { RouterModule, Routes } from "@angular/router";
import { CrudGridComponent, DirtyGuard, GridViewComponent, RecordResolver, TemplateResolver } from "@xdf/gallery";
import { TabsLayoutComponent, TabsTemplateResolver } from "@xdf/layouts";
import { AuthGuard, ResourceAuthGuard } from "@xdf/security";
import { CalendarFormComponent } from "./components/calendar/calendar-form/calendar-form.component";
import { CalendarExceptionTemplateResolver } from "./components/calendar/resolvers/calendar-exception-template.resolver";
import { CalendarExceptionResolver } from "./components/calendar/resolvers/calendar-exception.resolver";
import { GoalActionResolver } from "./components/goal/resolvers/goal-action.resolver";
import {  GoalActionTemplateResolver } from "./components/goal/resolvers/goal-template.resolver";
import { GoalFormComponent } from "./components/goal/views/goal-form.component";

import { SchedulerTaskComponent } from "./components/scheduler-task/scheduler-task.component";

const routes: Routes = [
    {
        path: '',
        component: TabsLayoutComponent,
        resolve: { template: TabsTemplateResolver },
        // canActivate: [ResourceTabsAuthGuard],
        data: {
            templateName: 'configuration-concept',
            programs: ['calendar', 'scheduler-task','goal']
        },
        children: [
            {
                path: 'scheduler-task', component: GridViewComponent, canActivate: [AuthGuard, ResourceAuthGuard],
                resolve: { template: TemplateResolver },
                data: {
                  program: 'SCHEDULER-TASK',
                  breadcrumb: 'breadcrumb.scheduler-task'
                }
              },
              {
                path: 'scheduler-task/detail/:mode', component: SchedulerTaskComponent, canActivate: [AuthGuard, ResourceAuthGuard], canDeactivate: [DirtyGuard],
                resolve: { record: RecordResolver },
                data: {
                  program: 'SCHEDULER-TASK',
                  breadcrumb: 'breadcrumb.scheduler-task.detail'
                }
              },
              {
                path: 'calendar', component: CrudGridComponent, canActivate: [AuthGuard, ResourceAuthGuard],
                resolve: { record: TemplateResolver },
                data: {
                  innerTemplate: 'none',
                  option: 'calendar',
                  program: 'CALENDAR',
                  breadcrumb: 'breadcrumb.calendar'
                }
              },
              {
                path: 'calendar/detail/:mode', component: CalendarFormComponent, canActivate: [AuthGuard, ResourceAuthGuard], canDeactivate: [DirtyGuard],
                resolve: { record: RecordResolver, calendarExceptionData: CalendarExceptionResolver, calendarExceptionTemplate: CalendarExceptionTemplateResolver },
                data: {
                  innerTemplate: 'none',
                  program: 'CALENDAR',
                  breadcrumb: 'breadcrumb.calendar.detail',
                }
              },
              {
                path: 'goal', component: CrudGridComponent, canActivate: [AuthGuard, ResourceAuthGuard],
                resolve: { record: TemplateResolver },
                data: {
                  innerTemplate: 'none',
                  option: 'goal',
                  program: 'GOAL',
                  breadcrumb: 'breadcrumb.goal'
                }
              },
              {
                path: 'goal/detail/:mode', component: GoalFormComponent, canActivate: [AuthGuard, ResourceAuthGuard], canDeactivate: [DirtyGuard],
                resolve: { record: RecordResolver, goalActonTemplate:  GoalActionTemplateResolver, goalActionData:  GoalActionResolver },
                data: {
                  innerTemplate: 'none',
                  program: 'GOAL',
                  breadcrumb: 'breadcrumb.goal.detail',
                }
              },
              
              
        ]
    },
]

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