import { mapGetters } from 'vuex'

export default {
  props: {
    currentRoute: {
      type: Object,
      default: () => ({}),
    },
    navigateNext: {
      type: Function,
      default: () => () => {},
    },
    navigatePrevious: {
      type: Function,
      default: () => () => {},
    },
    voucherDetails: {
      type: Object,
      required: true,
    },
  },
  computed: {
    ...mapGetters('itoken', ['getITokenRedemptionFormDetails']),
    getRedeemedProductList() {
      return this.getITokenRedemptionFormDetails.cart || []
    },
    getTotalPointsRedeemed() {
      return this.getRedeemedProductList.reduce((accumulate, current) => {
        return accumulate + current.quantity * current.unit_point
      }, 0)
    },
  },
}
