import {CONTENT_MESSAGE, IS_OPENED} from '../../constants/dialogConstants';

const moduleReducers = {};

moduleReducers[CONTENT_MESSAGE] = (state, action) => {
    return Object.assign({}, state, {
        dialogContent: action.dialogContent
    });
};

moduleReducers[IS_OPENED] = (state, action) => {
    return Object.assign({}, state, {
        isDialogOpen: action.isDialogOpen
    });
};

const dialogReducer = (state = {}, action) => {
    return moduleReducers[action.type]
        ? moduleReducers[action.type](state, action)
        : state;
};

export default dialogReducer;
