import { createStore } from 'vuex'

export default createStore({
  state: {
    loading: false,
    windowSize: {
      width: 0,
      height: 0,
    },
    patientCards: [],
    homePageDoctors: [],
    appointmentInfo: {},
    currentExamDate: null,
    examDateRange: [],
    examIndexArray: [],
    currentBook: {},
    yjReqNo: null,
  },
  mutations: {
    SET_LOADING: (state, payload) => (state.loading = payload),
    SET_WINDOWSIZE: (state, payload) => (state.windowSize = payload),
    SET_PATIENTCARDS: (state, payload) => (state.patientCards = payload),
    SET_HOMEPAGEDOCTORS: (state, payload) => (state.homePageDoctors = payload),
    SET_APPOINTMENTINFO: (state, payload) => (state.appointmentInfo = payload),
    SET_CURRENTEXAMDATE: (state, payload) => (state.currentExamDate = payload),
    SET_EXAMDATERANGE: (state, payload) => (state.examDateRange = payload),
    SET_EXAMINDEXARRAY: (state, payload) => (state.examIndexArray = payload),
    SET_CURRENTBOOK: (state, payload) => (state.currentBook = payload),
    SET_YJREQNO: (state, payload) => (state.yjReqNo = payload),
  },
  actions: {
    SET_LOADING({ commit }, payload) {
      commit('SET_LOADING', payload)
    },
    SET_WINDOWSIZE({ commit }, payload) {
      commit('SET_WINDOWSIZE', payload)
    },
    SET_PATIENTCARDS({ commit }, payload) {
      commit('SET_PATIENTCARDS', payload)
    },
    SET_HOMEPAGEDOCTORS({ commit }, payload) {
      commit('SET_HOMEPAGEDOCTORS', payload)
    },
    SET_APPOINTMENTINFO({ commit }, payload) {
      commit('SET_APPOINTMENTINFO', payload)
    },
    SET_CURRENTEXAMDATE({ commit }, payload) {
      commit('SET_CURRENTEXAMDATE', payload)
    },
    SET_EXAMDATERANGE({ commit }, payload) {
      commit('SET_EXAMDATERANGE', payload)
    },
    SET_EXAMINDEXARRAY({ commit }, payload) {
      commit('SET_EXAMINDEXARRAY', payload)
    },
    SET_CURRENTBOOK({ commit }, payload) {
      commit('SET_CURRENTBOOK', payload)
    },
    SET_YJREQNO({ commit }, payload) {
      commit('SET_YJREQNO', payload)
    },
  },
})
