import Actions from '@/types/Store/Actions';

export type PayOrderState = {
  waitPayOrderState: boolean;
};

const INITIAL_STATE = {
  waitPayOrderState: false,
};

export const updateOrderState = (state: boolean): Actions => ({
  type: 'UPDATE_ORDER_STATE',
  payload: state,
});

export default function orderState(
  state: PayOrderState = INITIAL_STATE,
  action: Actions,
) {
  switch (action.type) {
    case 'UPDATE_ORDER_STATE':
      return { ...state, waitPayOrderState: action.payload };

    default:
      return state;
  }
}
