import React, { Component } from 'react'
import { BrowserRouter, Route, Switch } from 'react-router-dom'

/* IMPORT COMPONENTS */
import Footer from '../components/Footer'
import Navigation from '../components/Navigation'
/* IMPORT PAGES */
import HomeC from '../pages/Home/HomeC'
import DevelopersC from '../pages/Developers/DevelopersC'
import ItemTypeC from '../pages/ItemType/ItemTypeC'
import ProfileC from '../pages/Profile/ProfileC'
import Results from '../pages/Results/Results'
import StatisticsC from '../pages/Statistics/StatisticsC'
import NoMatch from '../pages/NoMatch/NoMatchC'
import ViewItemC from '../pages/ViewItem/ViewItemC'
import EditItemC from '../pages/EditItem/EditItemC'
import AlertC from '../pages/Alerts/AlertC'

class User extends Component {
  render() {
  return (
    <BrowserRouter>
      <div>
        <Navigation />
        <Switch>
          <Route exact path='/' component={HomeC} />
          <Route exact path='/developers' component={DevelopersC} />
          <Route exact path='/createItem' render={(props) => <ItemTypeC {...props} userKey={this.props.userKey} />}/>
          <Route exact path='/viewItem/:itemId' render={(props) => <ViewItemC {...props} userKey={this.props.userKey} />}/>
          <Route exact path='/editItem/:itemId' render={(props) => <EditItemC {...props} userKey={this.props.userKey} userRole={this.props.userRole} />}/>
          <Route exact path='/profile' component={ProfileC} />
          <Route exact path='/results' component={Results} />
          <Route exact path='/statistics' component={StatisticsC} />
          <Route exact path='/error' component={AlertC} />
          <Route exact path='/success' component={AlertC} />
          <Route component={NoMatch} />
        </Switch>
        <Footer />
      </div>
    </BrowserRouter>
  )
}
}

export default User
