import { reactive, ref } from 'vue';

const state = reactive({
	assetInfo: null,
	deviceRealtime: null,
	currentPackage: null
});

export const useAssetStore = () => {
	const setAssetInfo = (info) => {
		state.assetInfo = info;
	};

	const setDeviceRealtime = (realtime) => {
		state.deviceRealtime = realtime;
	};

	const setCurrentPackage = (pkg) => {
		state.currentPackage = pkg;
	};

	const clearAsset = () => {
		state.assetInfo = null;
		state.deviceRealtime = null;
		state.currentPackage = null;
	};

	return {
		state,
		setAssetInfo,
		setDeviceRealtime,
		setCurrentPackage,
		clearAsset
	};
};