import Vue from 'vue';
import VueRouter from 'vue-router';

import Home from '../components/home/home.vue';
import Release from '../components/releases/release.vue';
import Site from '../components/sites/site.vue';
import Network from '../components/networks/network.vue';
import Networks from '../components/networks/networks.vue';
import Actor from '../components/actors/actor.vue';
import Actors from '../components/actors/actors.vue';
import Tag from '../components/tags/tag.vue';
import Tags from '../components/tags/tags.vue';
import NotFound from '../components/errors/404.vue';

Vue.use(VueRouter);

const routes = [
    {
        path: '/',
        redirect: { name: 'home' },
    },
    {
        path: '/home',
        component: Home,
        name: 'home',
    },
    {
        path: '/scene/:releaseId/:releaseSlug?',
        component: Release,
        name: 'scene',
    },
    {
        path: '/movie/:releaseId',
        component: Release,
        name: 'movie',
    },
    {
        path: '/actor/:actorSlug',
        component: Actor,
        name: 'actor',
    },
    {
        path: '/site/:siteSlug',
        component: Site,
        name: 'site',
    },
    {
        path: '/network/:networkSlug',
        component: Network,
        name: 'network',
    },
    {
        path: '/tag/:tagSlug',
        component: Tag,
        name: 'tag',
    },
    {
        path: '/actors/:gender?/:letter?',
        component: Actors,
        name: 'actors',
    },
    {
        path: '/networks',
        component: Networks,
        name: 'networks',
    },
    {
        path: '/tags',
        component: Tags,
        name: 'tags',
    },
    {
        path: '*',
        component: NotFound,
    },
];

const router = new VueRouter({
    mode: 'history',
    routes,
    afterEach(to, from) {
        console.log(to, from);
    },
});

export default router;
