const constantList = {
  EVENT_INTERRUPTED: Symbol('event_interrupted'),
  ADLEVENT_CANVAS_MOUSEMOVE: Symbol('adlevent_canvas_mousemove'),
  ADLEVENT_CANVAS_MOUSEUP: Symbol('adlevent_canvas_mouseup'),
  ADLEVENT_CANVAS_CLICK: Symbol('adlevent_canvas_click'),
  ADLEVENT_CANVAS_MOUSEDOWN: Symbol('adlevent_canvas_mousedown'),
  ADLEVENT_PAGE_CLICK: Symbol('adlevent_page_click'),
  ADLEVENT_PAGE_MOUSEDOWN: Symbol('adlevent_page_mousedown'),
  ADLEVENT_PAGE_MOUSEMOVE: Symbol('adlevent_page_mousemove'),
  ADLEVENT_PAGE_MOUSEUP: Symbol('adlevent_page_mouseup'),
  ADLEVENT_BLOCK_CLICK: Symbol('adlevent_block_click'),
  ADLEVENT_BLOCK_MOUSEDOWN: Symbol('adlevent_block_mousedown'),
  ADLEVENT_BLOCK_MOUSEUP: Symbol('adlevent_block_mouseup'),
  ADLEVENT_BLOCK_MOUSEMOVE: Symbol('adlevent_block_mousemove'),
  ADLEVENT_BLOCK_MOUSEENTER: Symbol('adlevent_block_mouseenter'),
  ADLEVENT_BLOCK_MOUSELEAVE: Symbol('adlevent_block_mouseleave'),
  ADLEVENT_BLOCK_DBLCLICK: Symbol('adlevent_block_dblclick'),
  ADLEVENT_BLOCK_MOVE: Symbol('adlevent_block_move'),
  ADLEVENT_BLOCK_RESIZE: Symbol('adlevent_block_resize'),
  PAGE_VERTICAL_A4: 'page_v_a4',
  PAGE_HORIZONTAL_A4: 'page_h_a4',
  PAGE_CUSTOM: 'page_custom',

  LAYER_BACKGROUND: 'layer_background',
  LAYER_FOREGROUND: 'layer_foreground',
  LAYER_CONTENT: 'layer_content',
  LAYER_CUSTOM: 'layer_custom',

  BLOCK_DEFAULT: 'block_default',

  NO_PAGE_CREATED: Symbol('no_page_created'),
  EMPTY_INPUT: Symbol('empty_input')
}

function constants (name) {
  return constantList[name]
}

function registerConstant (newConstant) {
  if (newConstant instanceof Array) {
    newConstant.forEach(constant => {
      if (!constantList[constant.toString()]) constantList[constant.toString()] = constant.toString()
    })
  } else if (typeof newConstant === 'string') {
    if (!constantList[newConstant.toString()]) constantList[newConstant.toString()] = newConstant.toString()
  } else {
    for (const constant in newConstant) {
      if (!constantList[constant.toString()]) constantList[constant.toString()] = newConstant[constant].toString()
    }
  }
}

export default constantList
export { constants, constantList as list, registerConstant }
