import { createSlice } from '@reduxjs/toolkit';

const initialState = {
  playerConfig: null,
  playerReady: false,
};

export const slice = createSlice({
  name: '@@STUDIO/PLAYER',
  initialState,
  reducers: {
    fetchPlayerConfigAction: (state) => state,
    setPlayerConfigAction: (state, action) => {
      state.playerConfig = action.payload;
    },
    setPlayerReadyAction: (state, action) => {
      state.playerReady = action.payload;
    },
    clearAction: () => initialState,
  },
});

export const { fetchPlayerConfigAction, setPlayerConfigAction, setPlayerReadyAction, clearAction } = slice.actions;

export default slice.reducer;
