import { dashboardComponentRoutes } from "../all-routes"
import {encryptURIparams} from '../../utility/Utils'

export const menuItems = (data, submitAction) =>{
    return{
        // firstMenuItem: {
        //     menuId: 'main-1', //random generated unique id
        //     additionalClass: (index) => {                
        //         return 'btn-action btn-default'
        //     },
        //     iconName: 'pencil-alt',
        //     menuTarget: '#',
        //     handler: (index) => { }
        // },
        // secondMenuItem: {
        //     iconName: 'trash-alt',
        //     menuId: 'main-2', //random generated unique id
        //     additionalClass: (index) => { 
        //         const commonClasses = 'btn-action btn-default'
        //         return `${commonClasses}`
        //     },
        //     menuTarget: '#' ,
        //     handler: (index) => { }
            
        // },
        firstMenuItem:  {
            iconName: 'eye-dropper',
            menuId: 'main-1', //random generated unique id
            additionalClass: (index) => {                
                return 'btn-action btn-default'
            },
            menuTarget: (index) => ('#'),
            handler: (index) => { 
                const { PatientId } = data[index]
                    submitAction(PatientId, index, ActionType.CHANGE_COLOR_CODE)  
            },
        },
        dropDownItems:[
            {
                iconName: 'notes-medical',
                menuId: 'sub-2', //random generated unique id
                menuTitle: 'View Medical History',
                menuTarget: (index) => { 
                    const { PatientId } = data[index]
                    var ciphertext = encryptURIparams(PatientId)
                    return `/dashboard/${dashboardComponentRoutes.CASE_HISTORY.route}/${ciphertext}`
                }
            },
            {
                iconName: 'clipboard-list',
                menuId: 'sub-3', //random generated unique id
                menuTitle: 'View Patients Daily Log',
                menuTarget: (index) => { 
                    const { PatientId, SubsCode } = data[index]
                    const cipherParams = encryptURIparams(`${PatientId}+${SubsCode}`)
                    return `/dashboard/${dashboardComponentRoutes.DAILY_LOGS.route}/${cipherParams}`
                }
            },
                {
                iconName: 'vials',
                menuId: 'sub-4', //random generated unique id
                menuTitle: 'View lab reports',
                menuTarget: (index) => { 
                    const { PatientId } = data[index]
                    var ciphertext = encryptURIparams(PatientId)
                    return `/dashboard/${dashboardComponentRoutes.LAB_REPORT.route}/${ciphertext}`
                }
            },/*
                {
                iconName: 'user-minus',
                menuId: 'sub-5', //random generated unique id
                menuTitle: 'Deactivate',
                menuTarget: (index) => ('#'),                
                handler: (index) => { 
                    const { PatientId } = data[index]
                    submitAction(PatientId, index, ActionType.DEACTIVATE_USER)
                }
            },
                {
                iconName: 'user-plus',
                menuId: 'sub-6', //random generated unique id
                menuTitle: 'Activate',
                menuTarget: (index) => ('#'),                
                handler: (index) => { 
                    const { PatientId } = data[index]
                        submitAction(PatientId, index, ActionType.ACTIVATE_USER)               
                    submitAction(PatientId, index, ActionType.ACTIVATE_USER)               
                        submitAction(PatientId, index, ActionType.ACTIVATE_USER)               
                    submitAction(PatientId, index, ActionType.ACTIVATE_USER)               
                        submitAction(PatientId, index, ActionType.ACTIVATE_USER)               
                    submitAction(PatientId, index, ActionType.ACTIVATE_USER)               
                        submitAction(PatientId, index, ActionType.ACTIVATE_USER)               
                }
            },*/
                {
                iconName: 'walking',
                menuId: 'sub-7', //random generated unique id
                menuTitle: 'Manage Visitors',
                menuTarget: (index) => { 
                    const { PatientId } = data[index]
                    var ciphertext = encryptURIparams(PatientId)
                    return  `/dashboard/${dashboardComponentRoutes.ALL_VISITORS.route}/${ciphertext}`
                
                }
            },
            {
                iconName: 'eye',
                menuId: 'sub-8', //random generated unique id
                menuTitle: 'View Profile',
                menuTarget: (index) => { 
                    const { PatientId } = data[index]
                    var ciphertext = encryptURIparams(PatientId)
                    return `/dashboard/${dashboardComponentRoutes.USER_PROFILE.route}/${ciphertext}`
                }                
                
            }
        ]
    }
}

export const menuItemsForEducator = (data, submitAction) =>{
    return{
        // menuTitle: 'Change Color Code',
            
        firstMenuItem:  {
            iconName: 'eye-dropper',
            menuId: 'main-1', //random generated unique id
            additionalClass: (index) => {                
                return 'btn-action btn-default'
            },
            menuTarget: '#',            
            handler: (index) => { 
                const { PatientId } = data[index]
                submitAction(PatientId, index, ActionType.CHANGE_COLOR_CODE)  
            },
        },
        
        dropDownItems:[
            {
                menuTitle: 'View Medical History',
                iconName: 'notes-medical',
                menuId: 'sub-2', //random generated unique id                
                menuTarget: (index) => { 
                    const { PatientId } = data[index]
                    var ciphertext = encryptURIparams(PatientId)
                    return `/dashboard/${dashboardComponentRoutes.CASE_HISTORY.route}/${ciphertext}`
                }
            },
            {
                iconName: 'clipboard-list',
                menuId: 'sub-3', //random generated unique id
                menuTitle: 'View Patients Daily Log',
                menuTarget: (index) => { 
                    const { PatientId, SubsCode } = data[index]
                    const cipherParams = encryptURIparams(`${PatientId}+${SubsCode}`)
                    return `/dashboard/${dashboardComponentRoutes.DAILY_LOGS.route}/${cipherParams}`
                }
            },
                {
                iconName: 'vials',
                menuId: 'sub-4', //random generated unique id
                menuTitle: 'View lab reports',
                menuTarget: (index) => { 
                    const { PatientId } = data[index]
                    var ciphertext = encryptURIparams(PatientId)
                    return `/dashboard/${dashboardComponentRoutes.LAB_REPORT.route}/${ciphertext}`
                }
            },
                {
                iconName: 'walking',
                menuId: 'sub-7', //random generated unique id
                menuTitle: 'Manage Visitors',
                menuTarget: (index) => { 
                    const { PatientId } = data[index]
                    var ciphertext = encryptURIparams(PatientId)
                    return  `/dashboard/${dashboardComponentRoutes.ALL_VISITORS.route}/${ciphertext}`
                
                }
            },
                {
                iconName: 'utensils',
                menuId: 'sub-8', //random generated unique id
                menuTitle: 'Prepare Diet Plan',
                menuTarget: (index) => { 
                    const { PatientId } = data[index]
                    var ciphertext = encryptURIparams(PatientId)
                    return  `/dashboard/${dashboardComponentRoutes.DIET_PLAN.route}/${ciphertext}`
                
                }
            }
        ]
    }
}

export const ActionType = {
    ACTIVATE_USER: 'ACTIVATE_USER',
    DEACTIVATE_USER: 'DE_ACTIVATE_USER',
    CHANGE_COLOR_CODE: 'CHANGE_COLOR_CODE',
}