import { Alert, } from 'react-native'
import ActionModel from '../ActionModel'
import { LoadingGlobalModalAN, } from '../constants'
import { LoadingGlobalModalStateM, } from '../../models/stateModels'
 

const initialState: LoadingGlobalModalStateM = {
    isShowModal: false,
}


var reducer = function(state = initialState, action: ActionModel)
{
    let { payload } = action

    switch(action.type)
    {
        case LoadingGlobalModalAN.SET_STATE:
            return { ...state, ...payload }


        case LoadingGlobalModalAN.TOGGLE_VISIBILITY:
            return { ...state, isShowModal: payload }
    }

    return state
}

export default reducer
