import * as types from '../constants/actionTypes';
import { ProgressType, ViewportType} from '../constants/type';

export default (dispatch: any) => ({
  setTotalPage: (page: number) => dispatch({ type: types.SET_TOTAL_PAGE, payload: page }),
  setCurrentPage: (page: number) => dispatch({ type: types.SET_CURRENT_PAGE, payload: page }),
  setPdf: (pdf: Object) => dispatch({ type: types.SET_PDF, payload: pdf }),
  setProgress: (progress: ProgressType) => dispatch({ type: types.SET_PROGRESS, payload: progress }),
  setViewport: (viewport: ViewportType) => dispatch({ type: types.SET_VIEWPORT, payload: viewport }),
  changeScale: (scale: number | string) => dispatch({ type: types.CHANGE_SCALE, payload: scale }),
  changeRotate: (rotation: number) => dispatch({ type: types.CHANGE_ROTATE, payload: rotation }),
})
