export default {
  getOrderShipping: state => state.shippingData,
  getOrderReviewStep: state => {
    return state.orderReviewStep
  },
  getReviewShippingStepStyle: state => {
    return state.reviewAndShipping
  },
  getPaymentStepStyle: state => {
    return state.makePayment
  },
  getCompletedStepStyle: state => {
    return state.orderCompleted
  },
  getOrderReviewItems: state => {
    return state.orderItems
  },
  isItemImageShow: state => {
    return state.orderItemImageShow
  },
  getOrderTransaction: state => {
    return state.orders
  },
  getSummaryPromo: state => {
    return state.orderSummaryPromo
  },
  getOrderSummary: state => {
    return state.orderSummary
  },
  getAdminFee: state => {
    let adminFee = 0
    return adminFee
  },
  getDeliveryFee: state => {
    let deliveryFee = 0
    return deliveryFee
  },
  getEwalletAmount: state => {
    return state.ewalletAmount
  },
  getShippingMethodUsed: state => {
    return state.shippingMethodUsed
  },
  getPaymentMethodUsed: state => {
    return state.paymentMethodUsed
  },
  getRecipientDetail: state => {
    return state.recipientDetail
  },
  getTotalItems: (state, getters) => {
    let totalQty = getters.getCartTotal
    if (getters.getSelectedFocItems !== undefined) {
      getters.getSelectedFocItems.forEach(item => {
        totalQty += item.quantity
      })
    }
    if (getters.getSelectedPwpItems !== undefined) {
      getters.getSelectedPwpItems.forEach(item => {
        totalQty += item.quantity
      })
    }
    return totalQty
  },
  getTotalPrice: (state, getters) => {
    let totalPrice = 0
    if (getters.getCartPrice !== undefined) {
      totalPrice = parseFloat(getters.getCartPrice.toString().replace(',', ''))
      getters.getSelectedPwpItems.forEach(item => {
        totalPrice += item.price
      })
    }
    return totalPrice
  },
  getTaxAmount: (state, getters) => {
    let grandTotal = 0.0
    let taxAmount = 0.0
    if (getters.getCartPrice !== undefined) {
      taxAmount = parseFloat(grandTotal.toString().replace(',', '')) * 0.06
    }
    return taxAmount
  },
  getGrandTotalInclGST: (state, getters) => {
    let grandTotal = 0.0
    let taxAmount = 0.0
    if (getters.getCartPrice !== undefined) {
      grandTotal = parseFloat(getters.getCartPrice.toString().replace(',', ''))
      taxAmount = getters.getTaxAmount
    }
    return grandTotal + taxAmount
  },
  getRoundAdjustAmount: (state, getters) => {
    let adminFee = getters.getAdminFee
    let deliveryFee = getters.getDeliveryFee
    let grandTotal = getters.getGrandTotalInclGST
    let ewalletPayment = getters.getEwalletAmount
    let roundAmount = adminFee + deliveryFee + grandTotal - ewalletPayment
    return roundAmount
  },
  getStates: state => {
    return state.states
  },
  getExistingAddress: state => {
    return state.existingAddresses
  },
  getCollPointState: state => {
    return state.collPointState
  },
  getCollPointCity: state => {
    return state.collPointCity
  },
  getCollectionPoint: state => {
    let colState = state.collPointState
    let colCity = state.collPointCity
    if (colState !== null && colCity !== null) {
      // TODO: fix this
      return [1]
    }
    return []
  },
  getEPPOnlineBanks: state => {
    return state.EPPOnlineIssuingBanks
  },
  getPaymentDocumentDetails: state => {
    return state.paymentDocumentDetails
  },
  getPaymentStepStatus: state => state.paymentStepStatus,
}
