// import Vue from 'vue'
import types from './mutation-types'

export default {
  [types.initialize] (state, data) {

    // console.log('initialize: mutations.js')
    // console.log(data)
    // state = Object.assign(state, data)
    // State config
    state.config.bluetoothAutoConnectMac = data.config.bluetoothAutoConnectMac
    state.config.hasBluetooth = data.config.hasBluetooth
    state.config.hasDj = data.config.hasDj
    state.config.hasSchedulesNextButton = data.config.hasSchedulesNextButton
    state.config.version = data.config.version
    state.config.prayerEnabled = data.config.prayerEnabled
    state.config.hasVolumeControl = data.config.hasVolumeControl
    // State Schedules
    state.schedules.currentSong.fileName = data.schedules.currentSong.fileName
    state.schedules.currentSong.originalName = data.schedules.currentSong.originalName
    state.schedules.currentSongIndex = data.schedules.currentSongIndex
    state.schedules.duration = data.schedules.duration
    state.schedules.position = data.schedules.position
    state.schedules.songCount = data.schedules.songCount
    state.schedules.vumeter.left = data.schedules.vumeter.left
    state.schedules.vumeter.right = data.schedules.vumeter.right
    // Connected
    state.connected = data.connected
    // Prayer Time
    state.itsPrayerTime = data.itsPrayerTime
    // Set Volume
    state.masterVolume = data.masterVolume
  },

  // Disconnect
  [types.disconnect] (state, data) {
    state.connected = false
  },

  [types.prayer] (state, data) {
    state.itsPrayerTime = data;
  },

  [types.volume] (state, data) {
    state.masterVolume = data;
  }
}
