77 lines
2.4 KiB
TypeScript
77 lines
2.4 KiB
TypeScript
import { useMembersStore } from '~/stores/members'
|
|
import { usePoliciesStore } from '~/stores/policies'
|
|
import { useStreamsStore } from '~/stores/streams'
|
|
import { useBudgetStore } from '~/stores/budget'
|
|
import { useScenariosStore } from '~/stores/scenarios'
|
|
import { useCashStore } from '~/stores/cash'
|
|
import { useSessionStore } from '~/stores/session'
|
|
|
|
export type AppSnapshot = {
|
|
members: any[]
|
|
policies: Record<string, any>
|
|
streams: any[]
|
|
budget: Record<string, any>
|
|
scenarios: Record<string, any>
|
|
cash: Record<string, any>
|
|
session: Record<string, any>
|
|
}
|
|
|
|
export function useFixtureIO() {
|
|
const exportAll = (): AppSnapshot => {
|
|
const members = useMembersStore()
|
|
const policies = usePoliciesStore()
|
|
const streams = useStreamsStore()
|
|
const budget = useBudgetStore()
|
|
const scenarios = useScenariosStore()
|
|
const cash = useCashStore()
|
|
const session = useSessionStore()
|
|
|
|
return {
|
|
members: members.members,
|
|
policies: {
|
|
equalHourlyWage: policies.equalHourlyWage,
|
|
payrollOncostPct: policies.payrollOncostPct,
|
|
savingsTargetMonths: policies.savingsTargetMonths,
|
|
minCashCushionAmount: policies.minCashCushionAmount,
|
|
deferredCapHoursPerQtr: policies.deferredCapHoursPerQtr,
|
|
deferredSunsetMonths: policies.deferredSunsetMonths,
|
|
surplusOrder: policies.surplusOrder,
|
|
paymentPriority: policies.paymentPriority
|
|
},
|
|
streams: streams.streams,
|
|
budget: {
|
|
budgetLines: budget.budgetLines,
|
|
overheadCosts: budget.overheadCosts,
|
|
productionCosts: budget.productionCosts,
|
|
currentPeriod: budget.currentPeriod
|
|
},
|
|
scenarios: {
|
|
sliders: scenarios.sliders,
|
|
activeScenario: scenarios.activeScenario
|
|
},
|
|
cash: {
|
|
cashEvents: cash.cashEvents,
|
|
paymentQueue: cash.paymentQueue,
|
|
currentCash: cash.currentCash,
|
|
currentSavings: cash.currentSavings
|
|
},
|
|
session: {
|
|
checklist: session.checklist,
|
|
draftAllocations: session.draftAllocations,
|
|
rationale: session.rationale,
|
|
currentSession: session.currentSession,
|
|
savedRecords: session.savedRecords
|
|
}
|
|
}
|
|
}
|
|
|
|
const importAll = (snapshot: AppSnapshot) => {
|
|
// TODO: Implement import functionality for all stores
|
|
// This will patch each store with the snapshot data
|
|
console.log('Import functionality to be implemented', snapshot)
|
|
}
|
|
|
|
return { exportAll, importAll }
|
|
}
|
|
|
|
|