/* eslint-disable no-param-reassign */
import { createSlice } from '@reduxjs/toolkit';

export const VIEW = {
  camera: 'camera',
  capture: 'capture',
  alprResults: 'alprResults',
  dataResults: 'dataResults',
};

export const initialState = {
  view: VIEW.camera,
};

const stateSlice = createSlice({
  name: 'state',
  initialState,
  reducers: {
    setView(state, { payload }) {
      state.view = payload;
    },
  },
});

export const {
  setView,
} = stateSlice.actions;

export default stateSlice.reducer;
