import * as actions from './actions'
import getters from './getters'
import mutations from './mutations'
import { SALES_CURRENT_SALE_ID, SALES_CURRENT_PAYMENT_ID } from '../../utils/localStorageKeys'

const state = {
  paymentModes: [],
  eppPaymentCodes: ['aeon', 'epp_moto', 'epp_online_ctbc', 'epp_online_ipay88', 'epp_online_indodana'],
  sale: {
    transaction_date: '2000-01-01',
    document_number: '',
    downline_member: {
      name: '',
    },
    payment_method: '-',
    cvs: {
      total_cv: 0,
    },
    order_fees: {
      total_gmp: 0,
    },
    selected: {
      shipping: {
        sale_delivery_method: 0,
      },
    },
    order_status: '',
    eVouchers: [],
  },
  currentSaleId: JSON.parse(localStorage.getItem(SALES_CURRENT_SALE_ID)) || 0,
  currentPayment: {},
  currentPaymentId: JSON.parse(localStorage.getItem(SALES_CURRENT_PAYMENT_ID)) || 0,
  currentPaymentIsQr: false,
  salesList: [],
  ekSmartSalesList: [],
  salesListData: [],
  salesListDataTotalRows: 0,
  salesListTotalRows: 0,
  ekSmartSalesListTotalRows: 0,
  creditNotePdf: '',
  saleInPreorder: '',
  saleEvouchers: [],
  redemptionReceipt: '',
  showLoadingPopup: false,
  qrCodeData: { image: '', link: '' },
  subscriptionSale: {
    products: [],
    kittings: [],
    order_fees: {
      total_gmp: '0.00',
      rounding_adjustment: '0.00',
      admin_fee: '0.00',
      admin_fee_tax: '0.00',
      delivery_fee: '0.00',
      delivery_fee_tax: '0.00',
      other_fee: '0.00',
      other_fee_tax: '0.00',
      total_nmp: '0.00',
    },
  },
  paymentStatus: null,
  onHoldPaymentMode: { is_paylater: false, is_cash_on_delivery: false },
}

export default {
  state,
  actions,
  mutations,
  getters,
}
