import UserActionTypes from "./user.types";

export const signInSuccess = user => ({
  type: UserActionTypes.SIGN_IN_SUCCESS,
  payload: user
});
export const signInFailure = errorMsg => ({
  type: UserActionTypes.SIGN_IN_FAILURE,
  payload: errorMsg
});

export const emailSignInStart = emailAndPassword => ({
  type: UserActionTypes.EMAIL_SIGN_IN_START,
  payload: emailAndPassword
});

export const checkUserSession = () => ({
  type: UserActionTypes.CHECK_USER_SESSION
});

export const signOutStart = () => ({
  type: UserActionTypes.SIGN_OUT_START
});
export const signOutSuccess = () => ({
  type: UserActionTypes.SIGN_OUT_SUCCESS
});

export const signOutFailure = error => ({
  type: UserActionTypes.SIGN_OUT_FAILURE,
  payload: error
});

export const unauthorizedUser = () => ({
  type: UserActionTypes.UNAUTHORIZED_USER
});

export const setUserLanguage = language => ({
  type: UserActionTypes.SET_USER_LANGUAGE,
  payload: language
});

export const updateUserDetails = userDetails => ({
  type: UserActionTypes.UPDATE_USER_DETAILS,
  payload: userDetails
});

export const updateUserDetailsSuccess = userDetails => ({
  type: UserActionTypes.UPDATE_USER_DETAILS_SUCCESS,
  payload: userDetails
});

export const setBodyshop = bodyshop => ({
  type: UserActionTypes.SET_SHOP_DETAILS,
  payload: bodyshop
});
