import { SHOW_PRINT_PREVIEW, CLOSE_PRINT_PREVIEW, SAVE_MESSAGE, CLOSE_PREVIEW, SHOW_PREVIEW,
  DIAG_SHOW,CLEAR_SEARCH_PARAM,SET_MR_INFO ,CLEAR_MR_INFO} from "../types/print";
import { showPrintPreview, closePrintPreview, saveMessage, showPreview, closePreview,diagShow,
  clearSearchParam,setMrId,clearMrId } from "../actions/print";

const initState = {
  visible: false,
  preVisible: false,
  saveMessage: {},
  diagShow: false,
  clearSearch:0,
  mrInfo:{
    update:0,
    mrId:'',
    mode: 'patientia'
  }
};
export default function(state = initState, action) {
  switch (action.type) {
    case SHOW_PRINT_PREVIEW:
      return showPrintPreview(state, action);
    case CLOSE_PRINT_PREVIEW:
      return closePrintPreview(state, action);
    case SHOW_PREVIEW:
      return showPreview(state, action);
    case CLOSE_PREVIEW:
      return closePreview(state, action);
    case SAVE_MESSAGE:
      return saveMessage(state, action);
    case DIAG_SHOW:
      return diagShow(state, action);
    case CLEAR_SEARCH_PARAM:
      return clearSearchParam(state, action);
    case SET_MR_INFO:
      return setMrId(state, action);
    case CLEAR_MR_INFO:
      return clearMrId(state, action);
    default:
      return state;
  }
}
