import { SHOW_CONFIG_MODAL, CLOSE_CONFIG_MODAL, CONFIRM_TYPE, SET_READ_MODE} from "../types/typeConfig";
import { showConfigModal, closeConfigModal, confirmType, setReadMode} from "../actions/typeConfig";
import config from '@config/index';

const initState = {
  visible: false,
  isPreIcss:false,//是否为引用预问诊数据
  typeConfig: config.defaultValue,
  readConfig:-1,    //回读/引用回来的配置
  readMode:-1,  //回读/引用回来的模式，-1即没有回读模式
  mode:config.defaultValue[0],       //设置的模式， 0:智能推送模式， 1：纯文本模式,用于切换选中状态
};
export default function(state = initState, action) {
  switch (action.type) {
    case SHOW_CONFIG_MODAL:
      return showConfigModal(state, action);
    case CLOSE_CONFIG_MODAL:
      return closeConfigModal(state, action);
    case CONFIRM_TYPE:
      return confirmType(state, action);
    case SET_READ_MODE:
      return setReadMode(state, action);
    default:
      return state;
  }
}
