import * as types from '../constants/ActionTypes';

const initialState = {
  tmpList: [],
  tmpListCount: 0,
  legalEntityList: [],
  legalEntityListCount: 0,
  waitForSignList: [],
  waitForSignListCount: 0,
  signList: [],
  signListCount: 0,
  backToFisrtPage: false,
  tmpDetail: {},
  contractDetail: {},
  lglEntSeals: [],
  lglEntSealsCount: 0,
  laborContractNum: {},
  reload: false,
  laborContractRemind: {},
  waitForTerminateList: [],
  waitForTerminateListCount: 0,
  QRCodeURL:''
}

export default function environment(state = initialState, action) {

  switch (action.type) {
    case types.LABOR_CONTRACT_TMP_LIST:
      return Object.assign({}, state, {
        tmpList: action.tmpList,
        tmpListCount: action.tmpListCount
      });
      break;
    case types.LABOR_CONTRACT_LEGAL_ENTITY_LIST_TEST:
      return Object.assign({}, state, {
        legalEntityList: action.legalEntityList,
        legalEntityListCount: action.legalEntityListCount
      });
      break;
    case types.WAIT_FOR_SIGN_LIST:
      return Object.assign({}, state, {
        waitForSignList: action.waitForSignList,
        waitForSignListCount: action.waitForSignListCount
      });
      break;
    case types.LABOR_CONTRACT_LIST:
      return Object.assign({}, state, {
        contractList: action.contractList,
        contractListCount: action.contractListCount
      });
      break;
    case types.ENT_SIGN_LIST:
      return Object.assign({}, state, {
        signList: action.signList,
        signListCount: action.signListCount
      });
      break;
    case types.LABOR_CONTRACT_TMP_DETAIL:
      return Object.assign({}, state, {
        tmpDetail: action.tmpDetail,
        tmpDetailFields: action.tmpDetailFields
      });
      break;
    case types.LABOR_CONTRACT_DETAIL:
      return Object.assign({}, state, {contractDetail: action.contractDetail});
      break;
    case types.LEGAL_ENTITY_SEALS:
      return Object.assign({}, state, {
        lglEntSeals: action.lglEntSeals,
        lglEntSealsCount: action.lglEntSealsCount
      });
      break;
    case types.LABOR_CONTRACT_NUM:
      return Object.assign({}, state, {laborContractNum: action.laborContractNum});
      break;
    case types.LABOR_CONTRACT_REMIND:
      return Object.assign({}, state, {laborContractRemind: action.laborContractRemind});
      break;
    case types.WAIT_FOR_TERMINATE_LIST:
      return Object.assign({}, state, {waitForTerminateList: action.waitForTerminateList,waitForTerminateListCount:action.waitForTerminateListCount});
      break;
      case types.LABOR_CONTRACT_QRCODE:
        return Object.assign({}, state, {QRCodeURL: action.QRCodeURL});
        break;
    case types.LABOR_CONTRACT_NEED_RELOAD:
      return Object.assign({}, state, {reload: action.reload});
      break;
    case types.BACK_TO_FIRST_PAGE:
      return Object.assign({}, state, {backToFisrtPage: action.backToFisrtPage});
      break;
    default:
      return state;
  }

};