import { mapGetters, mapActions } from 'vuex'

export const windowsMixin = {
  computed: {
    ...mapGetters('csAppWindowsUtils', [
      'getHeaderVisible',
      'getAppWindowDataSetCurrentRow',
      'getDataSet',
      'getDataSetIdentDataFieldValue',
      'getAppWindowDataSetFindRowAndFieldValue',
      'getAppWindowUniqIdentFromAppWindowIdent',
      'gAWUI',
      'gDCR',
      'gDLR',
      'gDFV',
      'gDLRFV',
      'gDIsEL',
      'getAppWindowModalWindows',
      'viewHTMLFromFile'
    ]),
  },
  methods: {
    ...mapActions('csAppWindowsUtils', [
      'setDataSetFieldValue',
      'refreshDataSet'
    ]),
    setDataSetIdentDataFieldValue: function(
      appWindowIdent,
      dataSetIdent,
      sourceKind,
      dataFieldIdent,
      dataFieldValue
    ) {
      this.setDataSetFieldValue({
        sourceKind: sourceKind,
        dataSet: this.getDataSet(appWindowIdent, dataSetIdent),
        dataFieldIdent: dataFieldIdent,
        dataFieldValue: dataFieldValue
      })
    },
    rfDS: function(appWindowIdent, dataSetIdent, refreshAggregates){
      this.refreshDataSet({ appWindowIdent, dataSetIdent, refreshAggregates })
    }
  }
}