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

export const getCurrentUser = state => state.user.currentUser
export const getLabReportList = state => state.labReport.result
export const getLabReportIsFetching = state => state.labReport.isFetching
export const getErrorMessage = state => state.labReport.errorMessage
export const getGetIsPatient = state => state.user.currentUser.userType === MettaSvr_Common.UserTypeEnum.Patients
export const getGetIsDoctor = state => state.user.currentUser.userType === MettaSvr_Common.UserTypeEnum.Doctor
export const getSavedResult = state => state.labReport.saveResult
export const getLabReportDownloadSavedResult = state => state.labReport.labReportResult
export const getLabReportDownloadInProgress = state => state.labReport.labReportDownloadInProgress
export const getIsSaving = state => state.labReport.submissionInProgress
export const getTotalItems = state => state.labReport.recordCount

export const getAccessToken = createSelector(
    getCurrentUser,
    user => user.accessToken
)
export const getCurrentUserId = createSelector(
    getCurrentUser,
    user => user.userId
)
