import { ADD_DIAGNOSTIC,  DEL_DIAGNOSTIC, UP_DIAGNOSTIC, DOWN_DIAGNOSTIC, SET_TREAT, GET_DIAGNOSTIC_STR, SET_DIAG_TO_MAINSUIT, GET_IS_FIRST,CLEAR_ALL_DIAG, SET_CLICK_DIAG } from '../types/diagnosticList';
import { addDiagnostic,  delDiagnostic, upDiagnostic, downDiagnostic, setTreat, getDiagnosticStr, setDiagToMainSuit, getIsFirst,clearAllDiag, setClickDiag} from '../actions/diagnosticList';

const initState = {
    isFirst: true,
    diagnosticList: [
        // {
        //     id: 1,
        //     name: '脑梗塞',
        //     type: 1
        // },
        // {
        //     id: 2,
        //     name: '高血压',
        //     type: 2
        // },
        // {
        //     id: 3,
        //     name: '慢性支气管炎',
        //     type: 1
        // },
        // {
        //     id: 4,
        //     name: '急性支气管炎',
        //     type: 2
        // },
        // {
        //     id: 5,
        //     name: '原发性高血压',
        //     type: 1
        // }
    ],
    mainSuitStr:''

}

export default function (state=initState, action) {
    switch(action.type) {
        case ADD_DIAGNOSTIC:
            return addDiagnostic(state, action);
        case DEL_DIAGNOSTIC: 
            return delDiagnostic(state, action);
        case UP_DIAGNOSTIC: 
            return upDiagnostic(state, action);
        case DOWN_DIAGNOSTIC: 
            return downDiagnostic(state, action);
        case SET_TREAT: 
            return setTreat(state, action);
        case GET_DIAGNOSTIC_STR:
            return getDiagnosticStr(state, action);
        case SET_DIAG_TO_MAINSUIT:
            return setDiagToMainSuit(state, action);
        case GET_IS_FIRST:
            return getIsFirst(state, action);
        case CLEAR_ALL_DIAG:
            return clearAllDiag(state, action);
        case SET_CLICK_DIAG: 
            return setClickDiag(state, action);
        default:
            return state;
    }
}
