import { Routes } from '@angular/router';

import { AuthComponent, HomeComponent, PageComponent, PagesComponent, ProductComponent } from '@components';
import { noauthGuard } from '@guards';
import { articleResolver, articlesResolver, productResolver } from '@resolvers';

export const NOAUTH_ROUTES: Routes = [
    {
        path: 'home',
        component: HomeComponent
    },
    {
        path: 'login',
        component: AuthComponent,
        canActivate: [ noauthGuard ]
    },
    {
        path: 'register',
        component: AuthComponent,
        canActivate: [ noauthGuard ]
    },
    {
        path: 'pages',
        component: PagesComponent,
        canActivate: [ noauthGuard ],
        resolve: {
            pageData: articlesResolver
        }
    },
    {
        path: 'page/:slug',
        component: PageComponent,
        canActivate: [ noauthGuard ],
        resolve: {
            pageData: articleResolver
        }
    },
    {
        path: 'product/:slug',
        component: ProductComponent,
        canActivate: [ noauthGuard ],
        resolve: {
            pageData: productResolver
        }
    },
    {
        path: '',
        redirectTo: 'home',
        pathMatch: 'full'
    }
];