export const setCurrentPage: ReducerFuncType = (state, { payload }) => ({
  ...state,
  currentPage: payload,
});

export const setTotalPage: ReducerFuncType = (state, { payload }) => ({
  ...state,
  totalPage: payload,
});

export const setPdf: ReducerFuncType = (state, { payload }) => ({
  ...state,
  pdf: payload,
});

export const setProgress: ReducerFuncType = (state, { payload }) => ({
  ...state,
  progress: payload,
});

export const setViewport: ReducerFuncType = (state, { payload }) => ({
  ...state,
  viewport: payload,
});

export const changeScale: ReducerFuncType = (state, { payload }) => ({
  ...state,
  scale: payload,
});

export const changeRotate: ReducerFuncType = (state, { payload }) => ({
  ...state,
  rotation: payload,
});

export const addAnnotation: ReducerFuncType = (state, { payload }) => ({
  ...state,
  annotations: [...state.annotations, ...payload.annotations],
  initiated: payload.init,
});

export const updateAnnotation: ReducerFuncType = (state, { payload }) => ({
  ...state,
  annotations: [...payload],
  initiated: true,
});

export const updateWatermark: ReducerFuncType = (state, { payload }) => ({
  ...state,
  watermark: {
    ...state.watermark,
    ...payload,
  },
});
