'use strict';

Object.defineProperty(exports, "__esModule", {
  value: true
});

var _react = require('react');

var _react2 = _interopRequireDefault(_react);

var _reactRouter = require('react-router');

var _defaults2 = require('lodash/defaults');

var _defaults3 = _interopRequireDefault(_defaults2);

var _AdminPage = require('./components/pages/AdminPage');

var _AdminPage2 = _interopRequireDefault(_AdminPage);

var _CreatePage = require('./components/pages/CreatePage');

var _CreatePage2 = _interopRequireDefault(_CreatePage);

var _DashboardPage = require('./components/pages/DashboardPage');

var _DashboardPage2 = _interopRequireDefault(_DashboardPage);

var _PublicPage = require('./components/pages/PublicPage');

var _PublicPage2 = _interopRequireDefault(_PublicPage);

var _RecordPageContainer = require('./containers/pages/RecordPageContainer');

var _RecordPageContainer2 = _interopRequireDefault(_RecordPageContainer);

var _RootPage = require('./components/pages/RootPage');

var _RootPage2 = _interopRequireDefault(_RootPage);

var _SearchPage = require('./components/pages/SearchPage');

var _SearchPage2 = _interopRequireDefault(_SearchPage);

var _SearchResultPageContainer = require('./containers/pages/SearchResultPageContainer');

var _SearchResultPageContainer2 = _interopRequireDefault(_SearchResultPageContainer);

var _LoginPageContainer = require('./containers/pages/LoginPageContainer');

var _LoginPageContainer2 = _interopRequireDefault(_LoginPageContainer);

var _LogoutPageContainer = require('./containers/pages/LogoutPageContainer');

var _LogoutPageContainer2 = _interopRequireDefault(_LogoutPageContainer);

var _ProtectedPageContainer = require('./containers/pages/ProtectedPageContainer');

var _ProtectedPageContainer2 = _interopRequireDefault(_ProtectedPageContainer);

var _withClassName = require('./enhancers/withClassName');

var _withClassName2 = _interopRequireDefault(_withClassName);

function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }

var defaultRouteConfig = {
  className: '',
  index: '/dashboard'
};

exports.default = function (routeConfig) {
  var _defaults = (0, _defaults3.default)({}, routeConfig, defaultRouteConfig),
      className = _defaults.className,
      index = _defaults.index,
      onEnterProtected = _defaults.onEnterProtected;

  return _react2.default.createElement(
    _reactRouter.Route,
    { path: '/', component: (0, _reactRouter.withRouter)((0, _withClassName2.default)(_RootPage2.default, className)) },
    _react2.default.createElement(_reactRouter.IndexRedirect, { to: index }),
    _react2.default.createElement(
      _reactRouter.Route,
      { component: _PublicPage2.default },
      _react2.default.createElement(_reactRouter.Route, { path: 'login', component: _LoginPageContainer2.default }),
      _react2.default.createElement(_reactRouter.Route, { path: 'logout', component: _LogoutPageContainer2.default })
    ),
    _react2.default.createElement(
      _reactRouter.Route,
      { component: _ProtectedPageContainer2.default, onEnter: onEnterProtected },
      _react2.default.createElement(_reactRouter.Route, { path: 'dashboard', component: _DashboardPage2.default }),
      _react2.default.createElement(_reactRouter.Route, { path: 'create', component: _CreatePage2.default }),
      _react2.default.createElement(_reactRouter.Route, { path: 'search', component: _SearchPage2.default }),
      _react2.default.createElement(_reactRouter.Route, {
        path: 'list/:recordType/:vocabulary/:csid/:subresource',
        component: _SearchResultPageContainer2.default
      }),
      _react2.default.createElement(_reactRouter.Route, {
        path: 'list/:recordType/:csid/:subresource',
        component: _SearchResultPageContainer2.default
      }),
      _react2.default.createElement(_reactRouter.Route, {
        path: 'list/:recordType(/:vocabulary)',
        component: _SearchResultPageContainer2.default
      }),
      _react2.default.createElement(_reactRouter.Route, { path: 'record/:recordType/:path1/:path2', component: _RecordPageContainer2.default }),
      _react2.default.createElement(_reactRouter.Route, { path: 'record/:recordType(/:path1)', component: _RecordPageContainer2.default }),
      _react2.default.createElement(_reactRouter.Route, { path: 'admin', component: _AdminPage2.default })
    )
  );
};