import {create} from 'zustand'

import type {MoneyManagement} from '../../generated/ManagingApi'

type CustomMoneyManagementStore = {
  setCustomMoneyManagement: (custom: MoneyManagement | null) => void
  moneyManagement: MoneyManagement | null
}

export const useCustomMoneyManagement = create<CustomMoneyManagementStore>((set) => ({
  moneyManagement: null,
  setCustomMoneyManagement: (custom) => {
    set((state) => ({
      ...state,
      moneyManagement: custom,
    }))
  },
}))
