import { createHistoryRouter } from 'atomic-router';
import { createBrowserHistory } from 'history';

import { Page404 } from './page-404';
import { PageHistory } from './page-history';
import { PageResult } from './page-result';
import { PageGenerate } from './page-generate';

export const routes = [
    { path: '/404', route: Page404.route },
    { path: '/history', route: PageHistory.route },
    { path: '/result/:postId', route: PageResult.route },
    { path: '/', route: PageGenerate.route },
];

export const history = createBrowserHistory();

export const router = createHistoryRouter({
  routes,
  notFoundRoute: Page404.route,
});

router.setHistory(history);
