import { createSelector } from 'reselect'
import { MettaSvr_Common } from '../helpers/action-enums'

export const getCurrentUser = state => state.user.currentUser
export const getUserIsSubmitting = state => state.user.submissionInProgress
export const getErrorMessage = state => state.user.errorMessage
export const getSaveResult = state => state.user.saveResult
export const getProfileDataSaveResult = state => state.user.profileDataSaveResult
export const getFeedbackSubmittedStatus = state => state.user.feedbackSubmittedSuccessfully
export const getTermsAndConditionsContent = state => state.user.termsContent

export const getCurrentUserProfile = createSelector(
    getCurrentUser,
    user => user.profile
)
export const getAccessToken = createSelector(
    getCurrentUser,
    user => user.accessToken
)
export const getCurrentUserId = createSelector(
    getCurrentUser,
    user => user.userId
)
export const getGetIsDoctor = createSelector(
    getCurrentUser,
    user => user.userType === MettaSvr_Common.UserTypeEnum.Doctor
) 

export const getGetIsEducator = createSelector(
    getCurrentUser,
    user => user.userType === MettaSvr_Common.UserTypeEnum.Educator
) 

export const getGetIsPatient = createSelector(
    getCurrentUser,
    user => user.userType === MettaSvr_Common.UserTypeEnum.Patients
) 

export const getGetIsVisitor = createSelector(
    getCurrentUser,
    user => user.userType === MettaSvr_Common.UserTypeEnum.Visitor
) 

export const getIsSuperAdmin = createSelector(
    getCurrentUser,
    user => user.isSuperAdmin
)

export const getDoctorId = createSelector(
    getCurrentUser,
    user => user.doctorUserId
)


export const getTermsAcceptedStatus = createSelector(
    getCurrentUser,
    user => user.isTermsConditionNeedToAgree
)

