import { Captacion, Notification } from 'src/models';
import { MutationTree } from 'vuex';
import { CaptacionState } from './CaptacionState';

export const mutations: MutationTree<CaptacionState> = {
  setData: (state, data?: Captacion) => {
    if (data === undefined) return;
    state.data = data;
  },
  setCaptacionBankAccounts: (state, data: any) => {
    state.bankAccounts = data;
  },
  setLoading: (state, value: boolean) => (state.loading = value),
  setDocumentFilter: (state, value) => (state.documentFilter = value),
  reset: (state) => {
    state.data = null;
    state.notifications.data = [];
  },
  setToken: (state, value: string) => (state.token = value),
  setNotifications: (state, data: Notification[]) => (state.notifications.data = data),
  setLoadingNotifications: (state, value: boolean) => (state.notifications.loading = value),
  setStats: (state, value) => (state.stats = value),
  setLoadingStats: (state, value: boolean) => (state.loadingStats = value),
  setLoadingItems: (state, value: boolean) => (state.loadingItems = value),
};
