import { NgModule } from '@angular/core';
import { Routes, RouterModule } from '@angular/router';

import { ContractTemplateCardComponent, ContractTemplateListComponent, ContractTemplateNewComponent} from "./contract-templates.component";
import { ProvisionTemplateCardComponent, ProvisionTemplateListComponent, ProvisionTemplateNewComponent} from "./provision-templates.component";

const routes: Routes = [
    {
        path: '',
        data: {
            title: 'Templates',
        },
        children: [{
            path: 'contracts',
            data: {
                title: 'Contracts',
            },
            children: [
                { path: '', redirectTo: 'list', pathMatch: 'full' },
                {
                    path: 'list',
                    component: ContractTemplateListComponent,
                    data: {
                        title: 'List',
                    },
                },
                {
                    path: 'new',
                    component: ContractTemplateNewComponent,
                    data: {
                        title: 'New',
                    },
                },
                {
                    path: ':id',
                    component: ContractTemplateCardComponent,
                    data: {
                        title: 'Card',
                    },
                },
            ],
        },
            {
                path: 'provisions',
                data: {
                    title: 'Provisions',
                },
                children: [
                    { path: '', redirectTo: 'list', pathMatch: 'full' },
                    {
                        path: 'list',
                        component: ProvisionTemplateListComponent,
                        data: {
                            title: 'List',
                        },
                    },
                    {
                        path: 'new',
                        component: ProvisionTemplateNewComponent,
                        data: {
                            title: 'New',
                        },
                    },
                    {
                        path: ':id',
                        component: ProvisionTemplateCardComponent,
                        data: {
                            title: 'Card',
                        },
                    },
                ],
            },
        ]
    }
];

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