const {
  crcTool
} = require('../../tools/crc-hash/index.js')
const filterCalculator = require('../../tools/filter/index.js')
const smdCodeCalculator = require('../../tools/smd-code/index.js')
const refrigerationCalculator = require('../../tools/refrigeration/index.js')
const reactanceCalculator = require('../../tools/reactance/index.js')
const threePhasePowerCalculator = require('../../tools/three-phase-power/index.js')

const commonHandlers = require('./handlers/common.js')
const crcHandlers = require('./handlers/crc.js')
const filterHandlers = require('./handlers/filter.js')
const reactanceHandlers = require('./handlers/reactance.js')
const refrigerationHandlers = require('./handlers/refrigeration.js')
const smdCodeHandlers = require('./handlers/smd-code.js')
const threePhasePowerHandlers = require('./handlers/three-phase-power.js')

function createToolInitialState() {
  return {
    ...crcTool.createInitialState(),
    ...filterCalculator.createInitialState(),
    ...smdCodeCalculator.createInitialState(),
    ...refrigerationCalculator.createInitialState(),
    ...reactanceCalculator.createInitialState(),
    ...threePhasePowerCalculator.createInitialState()
  }
}

const toolPageHandlers = {
  ...commonHandlers.handlers,
  ...crcHandlers.handlers,
  ...filterHandlers.handlers,
  ...reactanceHandlers.handlers,
  ...smdCodeHandlers.handlers,
  ...refrigerationHandlers.handlers,
  ...threePhasePowerHandlers.handlers
}

module.exports = {
  createToolInitialState,
  toolPageHandlers
}
