import { connect } from 'react-redux';

import { fetchItems } from '../actions/items.js';
import { fetchAuctionStatus } from '../actions/auctionStatus.js';

import { getAuctionItemsAsList } from '../selectors/items.js';

import Auction from './Auction.js';

const changeViewMode = () => true;

const matchStateToProps = (state) => ({
    items: getAuctionItemsAsList(state),
});

const mapDispatchToProps = (dispatch) => ({
    changeViewMode: (mode) => dispatch(changeViewMode(mode)),
    fetchItems: () => dispatch(fetchItems()),
    fetchStatus: () => dispatch(fetchAuctionStatus()),
});

export default connect(
    matchStateToProps,
    mapDispatchToProps,
)(Auction);
