import {
  FETCH_CURRENT_USER_REQUEST,
  FETCH_CURRENT_USER_SUCCESS,
  FETCH_CURRENT_USER_FAILURE,
  SUBSCRIBE_NEWSLETTER_REQUEST,
  SUBSCRIBE_NEWSLETTER_SUCCESS,
  SUBSCRIBE_NEWSLETTER_FAILURE,
  REQUEST_REGISTER,
  REQUEST_REGISTER_SUCCESS,
  REQUEST_REGISTER_FAILURE,
  ACCOUNT_CONFIRMATION_REQUEST,
  ACCOUNT_CONFIRMATION_SUCCESS,
  ACCOUNT_CONFIRMATION_FAILURE,
  SEND_CONFIRMATION_EMAIL_REQUEST,
  SEND_CONFIRMATION_EMAIL_SUCCESS,
  SEND_CONFIRMATION_EMAIL_FAILURE,
  UPDATE_USER_REQUEST,
  UPDATE_USER_SUCCESS,
  UPDATE_USER_FAILURE,
  RESET_PASSWORD_REQUEST,
  RESET_PASSWORD_SUCCESS,
  RESET_PASSWORD_FAILURE,
  SUBSCRIBE_USER_TO_PUSH_REQUEST,
  SUBSCRIBE_USER_TO_PUSH_SUCCESS,
  SUBSCRIBE_USER_TO_PUSH_FAILURE,
  FETCH_USER_SUBSCRIPTION_TO_PUSH_REQUEST,
  FETCH_USER_SUBSCRIPTION_TO_PUSH_SUCCESS,
  FETCH_USER_SUBSCRIPTION_TO_PUSH_FAILURE,
  UPDATE_USER_PICTURE_REQUEST,
  UPDATE_USER_PICTURE_SUCCESS,
  UPDATE_USER_PICTURE_FAILURE
} from '../types'


export const resetPasswordRequest = (payload) => ({
  type: RESET_PASSWORD_REQUEST,
  payload
});

export const resetPasswordSuccess = () => ({
  type: RESET_PASSWORD_SUCCESS,
});

export const resetPasswordFailure = (err) => ({
  type: RESET_PASSWORD_FAILURE,
  err
});

export const fetchCurrentUserRequest = () => ({
  type: FETCH_CURRENT_USER_REQUEST
});

export const fetchCurrentUserSuccess = user => ({
  type: FETCH_CURRENT_USER_SUCCESS,
  user
});

export const fetchCurrentUserFailure = user => ({
  type: FETCH_CURRENT_USER_FAILURE,
  user
});

export const registerUserRequest = (payload) => ({
  type: REQUEST_REGISTER,
  payload
});

export const registerUserSuccess = () => ({
  type: REQUEST_REGISTER_SUCCESS,

});

export const registerUserFailure = (err) => ({
  type: REQUEST_REGISTER_FAILURE,
  err
});

export const sendConfirmationEmailRequest = (payload) => ({
  type: SEND_CONFIRMATION_EMAIL_REQUEST,
  payload
});

export const sendConfirmationEmailSuccess = (payload) => ({
  type: SEND_CONFIRMATION_EMAIL_SUCCESS,
});

export const sendConfirmationEmailFailure = (err) => ({
  type: SEND_CONFIRMATION_EMAIL_FAILURE,
  err
});

export const subscribeToNewsletterRequest = (payload) => ({
  type: SUBSCRIBE_NEWSLETTER_REQUEST,
  payload
});

export const subscribeToNewsletterSuccess = () => ({
  type: SUBSCRIBE_NEWSLETTER_SUCCESS,
});

export const subscribeToNewsletterFailure = (err) => ({
  type: SUBSCRIBE_NEWSLETTER_FAILURE,
  err
});

export const requestConfirmationAccountRequest = (payload) => ({
  type: ACCOUNT_CONFIRMATION_REQUEST,
  payload
});

export const requestConfirmationAccountSuccess = () => ({
  type: ACCOUNT_CONFIRMATION_SUCCESS,
});

export const requestConfirmationAccountFailure = (err) => ({
  type: ACCOUNT_CONFIRMATION_FAILURE,
  err
});

export const updateUserRequest = (payload) => ({
  type: UPDATE_USER_REQUEST,
  payload
});

export const updateUserRequestSuccess = () => ({
  type: UPDATE_USER_SUCCESS,
});

export const updateUserRequestFailure = (err) => ({
  type: UPDATE_USER_FAILURE,
  err
});

export const subscribeUserToPushRequest = (payload) => ({
  type: SUBSCRIBE_USER_TO_PUSH_REQUEST,
  payload
});

export const subscribeUserToPushSuccess = () => ({
  type: SUBSCRIBE_USER_TO_PUSH_SUCCESS,
});

export const subscribeUserToPushFailure = (err) => ({
  type: SUBSCRIBE_USER_TO_PUSH_FAILURE,
  err
});

export const fetchUserSubscriptionToPushRequest = (payload) => ({
  type: FETCH_USER_SUBSCRIPTION_TO_PUSH_REQUEST,
  payload
});

export const fetchUserSubscriptionToPushSuccess = (res) => ({
  type: FETCH_USER_SUBSCRIPTION_TO_PUSH_SUCCESS,
  res
});

export const fetchUserSubscriptionToPushFailure = (err) => ({
  type: FETCH_USER_SUBSCRIPTION_TO_PUSH_FAILURE,
  err
});
export const updateUserPictureRequest = (payload) => ({
  type: UPDATE_USER_PICTURE_REQUEST,
  payload
})

export const updateUserPictureSuccess = (data) => ({
  type: UPDATE_USER_PICTURE_SUCCESS,
  data
})

export const updateUserPictureFailure = (err) => ({
  type: UPDATE_USER_PICTURE_FAILURE,
  err
})
