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

import { NotFoundComponent, RegistrationComponent } from './components';
import { ApiConsumerTokenResolve, LanguageResolve, TestParameterResolve } from './shared';

export const coreRoutes: Routes = [
    {
        path: ':lang',
        resolve: {
            lang: LanguageResolve
        },
        children: [
            {
                path: 'registration',
                component: RegistrationComponent,
                resolve: {
                    token: ApiConsumerTokenResolve,
                    test: TestParameterResolve
                }
            },
            {
                path: 'login', loadChildren: '../login/login.module#LoginModule'
            },
            {
                path: '404',
                component: NotFoundComponent
            },
            {
                path: 'myaccount', loadChildren: '../myaccount/myaccount.module#MyAccountModule'
            },
            {
                path: 'dashboard',
                redirectTo: '',
                pathMatch: 'full'
            }
        ]
    }
];

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