import { Action } from 'lib/types/interfaces';

export const signUp = (payload?) => ({
	type: '@@auth::SIGN_UP',
	payload: payload
}) as Action;

export const signedUp = (data?) => ({
	type: '@@auth::SIGNED_UP',
	...data
}) as Action;

export const failedSignUp = (error?) => ({
	type: '@@auth::FAILED_SIGN_UP',
	...error
}) as Action;

export const logIn = (payload?, rdr?) => ({
	type: '@@auth::LOGIN',
	payload: payload,
	rdr: rdr
}) as Action;

export const loggedIn = (data?) => ({
	type: '@@auth::LOGIN_SUCCESS',
	...data
}) as Action;

export const afterLoggedIn = () => ({
	type: '@@auth::AFTER_LOGIN_SUCCESS'
});

export const failedLogIn = (error?) => ({
	type: '@@auth::FAILED_LOGIN',
	...error
}) as Action;



export const logOut = () => ({
	type: '@@auth::LOGOUT'
}) as Action;

export const loggedOut = (data?) => ({
	type: '@@auth::LOGOUT_SUCCESS',
	...data
}) as Action;

export const failedLogOut = (error?) => ({
	type: '@@auth::FAILED_LOGOUT',
	...error
}) as Action;



export const fetchAuthUser = () => ({
	type: '@@auth::FETCH_AUTH_USER'
}) as Action;

export const fetchedAuthUser = (data?) => ({
	type: '@@auth::FETCHED_AUTH_USER',
	...data
}) as Action;

export const failedFetchAuthUser = (error?) => ({
	type: '@@auth::FAILED_FETCH_AUTH_USER',
	...error
}) as Action;



export const changePassword = (payload?) => ({
	type: '@@auth::CHANGE_PASSWORD',
	payload: payload
}) as Action;

export const changedPassword = (data?) => ({
	type: '@@auth::CHANGE_PASSWORD_SUCCESS',
	...data
}) as Action;

export const failedChangePassword = (error?) => ({
	type: '@@auth::FAILED_CHANGE_PASSWORD',
	...error
}) as Action;



export const resetPassword = (payload?) => ({
	type: '@@auth::RESET_PASSWORD',
	payload: payload
}) as Action;

export const didResetPassword = (data?) => ({
	type: '@@auth::RESET_PASSWORD_SUCCESS',
	...data
}) as Action;

export const failedResetPassword = (error?) => ({
	type: '@@auth::FAILED_RESET_PASSWORD',
	...error
}) as Action;



export const authorizePasswordResetRequest = (token?) => ({
	type: '@@auth::AUTHORIZE_PASSWORD_RESET_REQUEST',
	token: token
}) as Action;

export const authorizedPasswordResetRequest = (data?) => ({
	type: '@@auth::AUTHORIZED_PASSWORD_RESET_REQUEST',
	...data
}) as Action;

export const failedAuthorizePasswordResetRequest = (error?) => ({
	type: '@@auth::FAILED_AUTHORIZE_PASSWORD_RESET_REQUEST',
	...error
}) as Action;



export const completeResetPassword = (payload?) => ({
	type: '@@auth::COMPLETE_PASSWORD_RESET_REQUEST',
	payload: payload
}) as Action;

export const completedResetPassword = (data?) => ({
	type: '@@auth::COMPLETED_PASSWORD_RESET_REQUEST',
	...data
}) as Action;

export const failedCompleteResetPassword = (error?) => ({
	type: '@@auth::FAILED_COMPLETE_PASSWORD_RESET_REQUEST',
	...error
}) as Action;




export const sendConfirmEmailRequest = (token?) => ({
	type: '@@auth::SEND_EMAIL_CONFIRMATION_REQUEST',
	token: token
}) as Action;

export const sentConfirmEmailRequest = (data?) => ({
	type: '@@auth::SENT_EMAIL_CONFIRMATION_REQUEST',
	...data
}) as Action;

export const failedSendConfirmEmailRequest = (error?) => ({
	type: '@@auth::FAILED_SEND_EMAIL_CONFIRMATION_REQUEST',
	...error
}) as Action;



export const emailConfirmed = (data?) => ({
	type: '@@auth::EMAIL_CONFIRMED',
	...data
}) as Action;


export const updateProfile = (payload?) => ({
	type: '@@auth::UPDATE_PROFILE',
	payload: payload
}) as Action;


export const updatedProfile = (data?) => ({
	type: '@@auth::UPDATED_PROFILE',
	...data
}) as Action;


export const failedUpdateProfile = (error?) => ({
	type: '@@auth::FAILED_UPDATE_PROFILE',
	...error
}) as Action;




export const deleteAccount = (username?) => ({
	type: '@@auth::DELETE_SELF',
	username: username
}) as Action;


export const deletedAccount = (data?) => ({
	type: '@@auth::DELETED_SELF',
	...data
}) as Action;


export const failedDeleteAccount = (error?) => ({
	type: '@@auth::FAILED_DELETE_SELF',
	...error
}) as Action;




export const freezeAccount = (username?) => ({
	type: '@@auth::FREEZE_SELF',
	username: username
}) as Action;


export const frozeAccount = (data?) => ({
	type: '@@auth::FROZE_SELF',
	...data
}) as Action;


export const failedFreezeAccount = (error?) => ({
	type: '@@auth::FAILED_FREEZE_SELF',
	...error
}) as Action;



export const subscribeToEmail = () => ({
	type: '@@auth::SUBSCRIBE_TO_EMAIL'
}) as Action;


export const subscribedToEmail = (data?) => ({
	type: '@@auth::SUBSCRIBED_TO_EMAIL',
	...data
}) as Action;


export const failedSubscribeToEmail = (error?) => ({
	type: '@@auth::FAILED_SUBSCRIBE_TO_EMAIL',
	...error
}) as Action;



export const unsubscribeFromEmail = () => ({
	type: '@@auth::UNSUBSCRIBE_FROM_EMAIL'
}) as Action;


export const unsubscribedFromEmail = (data?) => ({
	type: '@@auth::UNSUBSCRIBED_FROM_EMAIL',
	...data
}) as Action;


export const failedUnsubscribeFromEmail = (error?) => ({
	type: '@@auth::FAILED_UNSUBSCRIBE_FROM_EMAIL',
	...error
}) as Action;



export const loginByGoogle = (user_hash?) => ({
	type: '@@auth::LOGIN_BY_GOOGLE',
	user_hash
});

export const loggedinByGoogle = (data?) => ({
	type: '@@auth::LOGGED_IN_BY_GOOGLE',
	...data
});

export const failedLoginByGoogle = (error?) => ({
	type: '@@auth::FAILED_LOGIN_BY_GOOGLE',
	...error
});



export const verifyPhone = (payload?): Action => ({
	type: '@@auth::VERIFY_PHONE',
	payload
});


export const verifiedPhone = (data?) => ({
	type: '@@auth::VERIFIED_PHONE',
	...data
});


export const failedVerifyPhone = (error?) => ({
	type: '@@auth::FAILED_VERIFY_PHONE',
	...error
});


export const resendPhoneVerificationCode = (payload?) => ({
	type: '@@auth::RESEND_PHONE_VERIFICATION_CODE',
	payload
});


export const resentPhoneVerificationCode = (data?) => ({
	type: '@@auth::RESENT_PHONE_VERIFICATION_CODE',
	...data
});


export const failedResendPhoneVerificationCode = (error?) => ({
	type: '@@auth::FAILED_RESEND_PHONE_VERIFICATION_CODE',
	...error
});



export const changePhoneForVerification = (payload?) => ({
	type: '@@auth::CHANGE_PHONE_FOR_VERIFICATION',
	payload
});


export const changedPhoneForVerification = (data?) => ({
	type: '@@auth::CHANGED_PHONE_FOR_VERIFICATION',
	...data
});


export const failedChangePhoneForVerification = (error?) => ({
	type: '@@auth::FAILED_CHANGE_PHONE_FOR_VERIFICATION',
	...error
});
