import React from 'react';
import { Redirect, Route, Switch, withRouter } from 'react-router-dom';
import PropTypes from 'prop-types';

import JKPrivacy from '../components/public/JKPrivacy';
import JKHelp from '../components/public/help/JKHelp';
import JKKnowledgeBase from '../components/public/help/JKKnowledgeBase';
import JKHelpDesk from '../components/public/help/JKHelpDesk';
import JKForum from '../components/public/help/JKForum';
import JKUnsubscribe from '../components/public/JKUnsubscribe';
import JKDownloads from '../components/public/JKDownloads';
import JKDownloadsLegacy from '../components/public/JKDownloadsLegacy';
import JKObsDownloads from '../components/public/JKObsDownloads';
import JKConfirmEmailChange from '../components/public/JKConfirmEmailChange';
import JKJamTracksLanding from '../components/jamtracks/JKJamTracksLandingDev';
import JKJamTracksArtistLanding from '../components/jamtracks/JKJamTracksArtistLandingDev';

const JKPublicRoutes = ({ match: { url } }) => (

  <Switch>
    <Route path={`${url}/privacy`} component={JKPrivacy} />
    <Route path={`${url}/help`} component={JKHelp} />
    <Route path={`${url}/knowledge-base`} component={JKKnowledgeBase} />
    <Route path={`${url}/help-desk`} component={JKHelpDesk} />
    <Route path={`${url}/forum`} component={JKForum} />
    {/* <Route path={`${url}/unsubscribe/:tok`} exact component={JKUnsubscribe} />
    <Route path={`${url}/confirm-email-change`} exact component={JKConfirmEmailChange} /> */}
    <Route path={`${url}/downloads`} exact component={JKDownloads} />
    <Route path={`${url}/downloads-legacy`} exact component={JKDownloadsLegacy} />
    <Route path={`${url}/obs-plugin-download`} exact component={JKObsDownloads} />
    <Route path={`${url}/backing-tracks/:artist/:song`} component={JKJamTracksLanding} />
    <Route path={`${url}/backing-tracks/:artist`} component={JKJamTracksArtistLanding} />

    {/*Redirect*/}
    <Redirect to="/errors/404" />
  </Switch>
);

JKPublicRoutes.propTypes = { match: PropTypes.object.isRequired };

export default withRouter(JKPublicRoutes);
