import { createSelector } from 'reselect'
import { MettaSvr_Common } from '../../helpers/action-enums'
import {getCurrentUser } from '../../user/selectors'
export const getDietChartIsFetching = state => state.dietPlan.isFetching
export const getErrorMessage = state => state.dietPlan.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.dietPlan.saveResult
export const getResult = state => state.dietPlan.result
export const getIsSaving = state => state.dietPlan.submissionInProgress
export const getIsFetching = state => state.dietPlan.isFetching

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