import { createSlice } from '@reduxjs/toolkit';
import defaultSettings from '../settings.json';

export interface GlobalState {
  settings?: typeof defaultSettings;
}

const initialState: GlobalState = {
  settings: defaultSettings
};

const globalSlice = createSlice({
  name: 'global',
  initialState,
  reducers: {
    updateSettings(state, action) {
      state.settings = action.payload.settings;
    }
  }
});

export const { updateSettings } = globalSlice.actions;

export default globalSlice.reducer;

