import { createRouter, createWebHashHistory } from 'vue-router'

import GameList from '../vues/GameList.vue'
import GameDetails from '../vues/GameDetails.vue'
import CharacterList from '../vues/CharacterList.vue'
import CharacterDetails from '../vues/CharacterDetails.vue'

const root = {
  path: '/',
  redirect: '/games'
}

const gameListRoute = {
  path: '/games',
  component: GameList
}

const gameDetailsRoute = {
  path: '/games/:gameId',
  component: GameDetails
}

const characterListRoute = {
  path: '/characters',
  component: CharacterList
}

const characterDetailsRoute = {
  path: '/characters/:characterId',
  component: CharacterDetails
}

const routes = [root, gameListRoute, gameDetailsRoute, characterListRoute, characterDetailsRoute]

export default createRouter({
  history: createWebHashHistory(),
  routes
})
