import PhotosActionTypes from "./photos.types";

export const openImagePicker = (jobid) => ({
  type: PhotosActionTypes.OPEN_IMAGE_PICKER,
  payload: jobid
});

export const mediaUploadStart = (imagePickerResult) => ({
  type: PhotosActionTypes.MEDIA_UPLOAD_START,
  payload: imagePickerResult,
})

export const mediaUploadProgressOne = (progressUpdate) => ({
  type: PhotosActionTypes.MEDIA_UPLOAD_PROGRESS_UPDATE_ONE,
  payload: progressUpdate,
});

export const mediaUploadFailure = (error) => ({
  type: PhotosActionTypes.MEDIA_UPLOAD_FAILURE,
  payload: error,
});

export const mediaUploadSuccessOne = (photo) => ({
  type: PhotosActionTypes.MEDIA_UPLOAD_SUCCESS_ONE,
  payload: photo,
});

export const mediaUploadProgressBulk = (info) => ({
  type: PhotosActionTypes.MEDIA_UPLOAD_PROGRESS_UPDATE_BULK,
  payload: info,
});

export const mediaUploadCompleted = (photo) => ({
  type: PhotosActionTypes.MEDIA_UPLOAD_COMPLETED,
  payload: photo,
});

export const deleteMedia = (photos) => ({
  type: PhotosActionTypes.DELETE_MEDIA,
  payload: photos,
});

export const deleteMediaSuccess = (photos) => ({
  type: PhotosActionTypes.DELETE_MEDIA_SUCCESS,
  payload: photos,
});

export const deleteMediaFailure = (photos) => ({
  type: PhotosActionTypes.DELETE_MEDIA_FAILURE,
  payload: photos,
});
export const clearUploadError = () => ({
  type: PhotosActionTypes.CLEAR_UPLOAD_ERROR,
});


export const addUploadCancelTask = (payload) => ({
  type: PhotosActionTypes.ADD_UPLOAD_CANCEL_TASK,
  payload,
});

export const removeUploadCancelTask = (payload) => ({
  type: PhotosActionTypes.REMOVE_UPLOAD_CANCEL_TASK,
  payload,
});

export const cancelUploads = () => ({
  type: PhotosActionTypes.CANCEL_UPLOADS,
});