const controlService = require('./control-service')
const themeService = require('./theme-service')
const {
  getStatusSummaryState
} = require('./status-page-state')

function getControlPageState(
  controlState = controlService.getState(),
  themeState = themeService.getState()
) {
  return {
    ...controlState,
    ...themeState,
    canReadStatus: !!controlState.connectedDevice && !controlState.isBootloaderBusy,
    statusSummary: getStatusSummaryState()
  }
}

module.exports = {
  getControlPageState
}
