'use strict';

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

var _react = require('react');

var _react2 = _interopRequireDefault(_react);

var _propTypes = require('prop-types');

var _propTypes2 = _interopRequireDefault(_propTypes);

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

var _reactIntl = require('react-intl');

var _reactHelmet = require('react-helmet');

var _reactHelmet2 = _interopRequireDefault(_reactHelmet);

var _classnames = require('classnames');

var _classnames2 = _interopRequireDefault(_classnames);

var _ProtectedRouteContainer = require('../../containers/routes/ProtectedRouteContainer');

var _ProtectedRouteContainer2 = _interopRequireDefault(_ProtectedRouteContainer);

var _PublicRoute = require('../routes/PublicRoute');

var _PublicRoute2 = _interopRequireDefault(_PublicRoute);

var _AdminPageContainer = require('../../containers/pages/AdminPageContainer');

var _AdminPageContainer2 = _interopRequireDefault(_AdminPageContainer);

var _ConfigPage = require('./ConfigPage');

var _ConfigPage2 = _interopRequireDefault(_ConfigPage);

var _ContentViewerPageContainer = require('../../containers/pages/ContentViewerPageContainer');

var _ContentViewerPageContainer2 = _interopRequireDefault(_ContentViewerPageContainer);

var _CreatePageContainer = require('../../containers/pages/CreatePageContainer');

var _CreatePageContainer2 = _interopRequireDefault(_CreatePageContainer);

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

var _DashboardPage2 = _interopRequireDefault(_DashboardPage);

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

var _LoginPageContainer2 = _interopRequireDefault(_LoginPageContainer);

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

var _LogoutPageContainer2 = _interopRequireDefault(_LogoutPageContainer);

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

var _RecordPageContainer2 = _interopRequireDefault(_RecordPageContainer);

var _ReportViewerPageContainer = require('../../containers/pages/ReportViewerPageContainer');

var _ReportViewerPageContainer2 = _interopRequireDefault(_ReportViewerPageContainer);

var _ResetPasswordPage = require('./ResetPasswordPage');

var _ResetPasswordPage2 = _interopRequireDefault(_ResetPasswordPage);

var _SearchPageContainer = require('../../containers/pages/SearchPageContainer');

var _SearchPageContainer2 = _interopRequireDefault(_SearchPageContainer);

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

var _SearchResultPageContainer2 = _interopRequireDefault(_SearchResultPageContainer);

var _NotificationBarContainer = require('../../containers/notification/NotificationBarContainer');

var _NotificationBarContainer2 = _interopRequireDefault(_NotificationBarContainer);

var _RootPage = require('../../../styles/cspace-ui/RootPage.css');

var _RootPage2 = _interopRequireDefault(_RootPage);

var _favicon = require('../../../images/favicon.png');

var _favicon2 = _interopRequireDefault(_favicon);

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

const messages = (0, _reactIntl.defineMessages)({
  title: {
    'id': 'rootPage.title',
    'defaultMessage': 'CollectionSpace'
  }
});

const propTypes = {
  className: _propTypes2.default.string,
  intl: _reactIntl.intlShape
};

function RootPage(props) {
  const className = props.className,
        intl = props.intl;


  const classes = (0, _classnames2.default)(_RootPage2.default.common, className);
  const title = intl.formatMessage(messages.title);

  return _react2.default.createElement(
    'div',
    { className: classes },
    _react2.default.createElement(
      _reactHelmet2.default,
      {
        defaultTitle: title,
        titleTemplate: `%s | ${title}`
      },
      _react2.default.createElement('link', { rel: 'shortcut icon', href: _favicon2.default })
    ),
    _react2.default.createElement(
      _reactRouter.Switch,
      null,
      _react2.default.createElement(_PublicRoute2.default, { path: '/login', component: _LoginPageContainer2.default }),
      _react2.default.createElement(_PublicRoute2.default, { path: '/logout', component: _LogoutPageContainer2.default }),
      _react2.default.createElement(_PublicRoute2.default, { path: '/config', component: _ConfigPage2.default }),
      _react2.default.createElement(_PublicRoute2.default, { path: '/resetpw', component: _ResetPasswordPage2.default }),
      _react2.default.createElement(_ProtectedRouteContainer2.default, { path: '/dashboard', component: _DashboardPage2.default }),
      _react2.default.createElement(_ProtectedRouteContainer2.default, { path: '/create', component: (0, _reactIntl.injectIntl)(_CreatePageContainer2.default) }),
      _react2.default.createElement(_ProtectedRouteContainer2.default, { path: '/admin', component: _AdminPageContainer2.default }),
      _react2.default.createElement(_ProtectedRouteContainer2.default, {
        path: '/search/:recordType?/:vocabulary?',
        component: _SearchPageContainer2.default
      }),
      _react2.default.createElement(_ProtectedRouteContainer2.default, {
        path: '/list/:recordType/:vocabulary/:csid/:subresource',
        component: _SearchResultPageContainer2.default
      }),
      _react2.default.createElement(_ProtectedRouteContainer2.default, {
        path: '/list/:recordType/:csid/:subresource',
        component: _SearchResultPageContainer2.default
      }),
      _react2.default.createElement(_ProtectedRouteContainer2.default, {
        path: '/list/:recordType/:vocabulary?',
        component: _SearchResultPageContainer2.default
      }),
      _react2.default.createElement(_ProtectedRouteContainer2.default, {
        path: '/record/:recordType/:path1?/:path2?/:path3?',
        component: _RecordPageContainer2.default
      }),
      _react2.default.createElement(_ProtectedRouteContainer2.default, {
        path: '/view/:contentPath+',
        component: _ContentViewerPageContainer2.default,
        decorated: false
      }),
      _react2.default.createElement(_ProtectedRouteContainer2.default, {
        path: '/report/:reportCsid',
        component: _ReportViewerPageContainer2.default,
        decorated: false
      })
    ),
    _react2.default.createElement(_NotificationBarContainer2.default, null)
  );
}

RootPage.propTypes = propTypes;

exports.default = (0, _reactIntl.injectIntl)(RootPage);