// redux/slices/firmwareProgressSlice.ts
import { createSlice, PayloadAction } from "@reduxjs/toolkit";

interface State {
  progress: number;
  isUpdating: boolean;
}

const initialState: State = {
  progress: 0,
  isUpdating: false,
};

export const firmwareProgressSlice = createSlice({
  name: "firmwareProgress",
  initialState,
  reducers: {
    setProgress: (state, action: PayloadAction<number>) => {
      state.progress = action.payload;
    },
    setIsUpdating: (state, action: PayloadAction<boolean>) => {
      state.isUpdating = action.payload;
    },
  },
});

export const { setProgress, setIsUpdating } = firmwareProgressSlice.actions;
export default firmwareProgressSlice.reducer;
