import {NgModule} from '@angular/core';
import {RouterModule, Routes} from '@angular/router';
import {AuthGuard} from './authorization/guards/auth.guard';

const routes: Routes = [
    {
        path: '',
        redirectTo: 'home',
        pathMatch: 'full'
    },
    {
        path: 'list',
        redirectTo: 'followings/list',
    },
    {
        path: 'matrix',
        redirectTo: 'followings/matrix',
    },
    {
        path: 'table',
        redirectTo: 'followings/table',
    },
    {
        path: 'home',
        loadChildren: () => import('./home/home.module').then(m => m.HomeModule),
    },
    {
        path: 'authorize',
        loadChildren: () => import('./authorization/authorization.module').then(m => m.AuthorizationModule),
    },
    {
        path: 'sync',
        loadChildren: () => import('./sync/sync.module').then(m => m.SyncModule),
        canActivate: [AuthGuard],
    },
    {
        path: 'lists',
        loadChildren: () => import('./lists/lists.module').then(m => m.ListsModule),
        canActivate: [AuthGuard],
    },
    {
        path: 'followings',
        loadChildren: () => import('./followings/followings.module').then(m => m.FollowingsModule),
        canActivate: [AuthGuard],
    },

];

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